The ability to load the .class files dynamically at run-time
Hot Deployment:
The ability to deploy the .class files in Application/Web server at run-time
How do you do it?
Many solutions and no silver bullet yet!
One such solution follows....
Tools you need:
- Eclipse (tested with Ver. 3.4). Ensure WTP is installed
- FileSync eclipse plugin
Download and install from http://andrei.gmxhome.de/filesync/index.html - JBoss-Tools eclipse plugin
Download and install from http://www.jboss.org/tools/download
We need to configure JBoss server within Eclipse. The one provided by WTP is not advanced enough. - Maven/Ant (if your project uses it)
Any conventional directory structure is fine - Java-Rebel .jar (license required)
Download Trial version from http://www.zeroturnaround.com/javarebel/download/
The Key Enabler (...with some limitations):
- Java Rebel provides a seamless solution to a good extent
- Has an Annual license of $59/user
- EXPLORE: http://www.zeroturnaround.com/javarebel/
- BUY: http://sales.zeroturnaround.com/
The website also lists the comparison here.
Configuration Steps:
- Ensure all the plugins are installed
- Ensure eclipse is using JDK as Java runtime
- Enable JBoss Server View
- Configure JBoss Server ...including Java-Rebel settings
- Checkout code using SVN and create your default Java project. Assuming Maven structure, build once using console and charge-up your local .m2 repository
- Create empty eclipse WTP Dynamic Web Project
- Link src and resources folder in WTP_Project to the above Maven-Java project
- Copy ‘lib’ folder from ear/target folder into WEB-INF/lib in WTP project
- FileSync web/src/main/webapp to WTP_Project/WebContent folder
- Set output path for your WTP_Project as WEB-INF/classes
- Fire up your server from within Eclipse
- Any code changes you’ll make are in your Maven project
JBoss Server View settings:
- Automatically publish set to 0 sec
- Server start timeout increased >300s
- Custom Deploy directories
- JMX admin password
JBoss Launch Configuration VM arguments in JBoss Server View:
Dprogram.name="JBossTools JBoss 4.0 Runtime" -Xms256m -Xmx512m -XX:MaxPermSize=256m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djava.endorsed.dirs="C:/NOSCAN/jboss-4.0.5/lib/endorsed" -noverify -javaagent:C:/javarebel-2.0/javarebel.jar -Drebel.spring_plugin=true -Drebel.aspectj_plugin=true
The BOTTOM LINE
- No ‘build’ segment
◦Code in Eclipse is always “Build Automatically” - No ‘deploy’ segment
◦If you abide by the Java-rebel capabilities - Rapid feedback (including Spring IoC)
◦All spring layers (controller, command, dao, Beans) - Original code base not affected by Eclipse WTP project
- Occasional restart of Jboss within Eclipse, when
◦Redefining Interface
◦Updating ‘static’ block - No JBoss Crashing in Eclipse with JBoss Tools plugin…so far.
ENJOY.....and smart coding...
Good post. I was also frustrated by the slow deployment cycles, and accidentally hit almost the same solution. Not using JBoss Tools though, just running JBoss in external terminal works fine as well.
ReplyDelete