Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get Java "hot code replacement" working in JBoss?

I am running JBoss 4.0.3.SP1_CP04 and connecting to it with Eclipse 3.4.1's debugger, both using JDK 1.6.0_11.

When I make a minor change to a method (e.g. changing a "+ 1" in the logic to a "+ 2") and save it, I immediately receive an error message dialog titled "Hot Code Replace Failed" with the error "Delete method not implemented"

Hot code replace failed dialog http://img6.imageshack.us/img6/531/hotcodereplacefailedkp6.png

Can anyone suggest steps for getting this to work?

like image 564
Brett Avatar asked Feb 11 '09 19:02

Brett


4 Answers

What you want to do is deploy to JBOSS as an exploded WAR. Typically, if an editor does the initial deploy itself, it will then manage copying individual files over as they change.

In IntelliJ, this is easy. I have never done it from Eclipse, but this project is your best bet.

like image 105
Chase Seibert Avatar answered Oct 21 '22 14:10

Chase Seibert


I have been using JRebel and it's a life saver as far as modifying code and dynamically updating the app server. Paid for itself the first day. (we have a 7 minute compile/deploy/restart cycle)

like image 32
Javamann Avatar answered Oct 21 '22 14:10

Javamann


  1. Before running debugger in Eclipse insure all projects in your workspace are refreshed (it is required if code was changed outside Eclipse, e.g. after getting changes from version control system using outside tool)
  2. In Java Build Path of Eclipse insure you don't include as a part of some library classes which you are trying to hot swap
  3. Check that Eclipse JRE = JBoss JRE
  4. Check class you are trying to hot swap. Does it have inner classes? I just run into issue when I can't swap class with inner class, while other classes are swapped without issues.
like image 25
phantom4 Avatar answered Oct 21 '22 15:10

phantom4


The reason is that the assembly can be used another compiler that hot swap. For example, if you build project by maven, we used javac. When you try to perform a hot swap etslipse uses built-in compiler jdt compiler(compiler is not taken from installed jdk and can not be changed by regular means.). Binary classes obtained are different and jvm can not replace them.

like image 24
Roman Avatar answered Oct 21 '22 15:10

Roman