Wednesday, February 17, 2010

Hot code replace failed - Scheme change not implemented

This issue has been hitting my team for a while, some people like me were more lucky and some were simply not getting "hot code replace" working in the server while changing it from Eclipse.

And I was truly lucky using hot deployments for Tomcat and JBoss so far up to Today when after installing Eclipse in my personal MAC I found out myself on the same boat:

Hot code replace failed - Scheme change not implemented
 Well, without getting into too much detail this happens when the Server is running classes that were not compiled with the same compiler Eclipse is using.

Of course you need to run your application server with the below flags (>=JDK 5)to be able to connect to a debug port and hot deploy:
JAVA_OPTS="$JAVA_OPTS -Xdebug -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n"

But wait a second, why it did not happen to me before? It turned out to be the way I usually worked:

1. I use Maven to build from command prompt and the Maven Eclipse Plugin to build from Eclipse.
2. I have Eclipse building automatically and the compiled code goes into the Maven target directory.
3. I deploy into Tomcat / JBoss using custom maven profiles and I do run them from command prompt.
The above configuration would fail to "hot code replace" so what do I do different on my workplace MAC?

In my workplace I use a local Ubuntu VM running on my MAC and there I have a script that will *not* clean the target when building. I was trying maven using the clean option in my personal MAC and so my compiler was different from the one in use by Eclipse.

So if we are sure that we never clean from Maven but only from Eclipse the steps above will work amazingly good. Now I know why my crew was suffering and for sure they will get more Agile from now on.


Gijo John said...

I am building from Eclipse and then run the deployed code ..... so the question of using different vms should not arise .
And earlier HotCode changes were just fine .

Please give me some other pointers

Nestor Urquiza said...

I have posted about your issue on

Basically there are limitations (for example you cannot change a method signature). There is work in progress to make HotSwap better but at this time still you need to live with the sad fact that your changes must be done within methods.

I have seen Eclipse notifying it cannot hot deploy and after a second attempt (after pressing continue) it does work but again the code must be contained within a method for that to work.

If hot deployment (HotSwap) is not working even within your method then take a look at the link provided above just in case you are missing something.

If you are running your server embedded in Eclipse I recommend you run it outside Eclipse and connect to its remote port from Eclipse to see if HotSwap does work. Probably you just need to configure the options your server runs with when it is started by Eclipse. I really do not use the embedded servers as I love separation of concerns.

Karel Hübl said...

In my case "Hot code replace failed - Scheme change not implemented" was caused by IDE using another compiler than compiler used to build files deployed on J2EE server. You can binary compare class files in your J2EE archive with class files compiled by IDE in your workspace - they should be identical.
For details see:

Tomas Tunkl said...

Hi I have problem with hot code, I can change classes but not static content like css or jsp, these will redeploy jboss. Any hints? Thx

Nestor Urquiza said...

@Tomas, to be able to get your static content deployed you need to either use a technique like rsync to push your files to an exploded deployed application or use your IDE like I explained before in