Sunday, February 1, 2009

JavaRebel - nice tool to help with J2EE App hot-deployments

Recently, I got a license of JavaRebel software created by ZeroTurnaround development group. This tool uses a custom Java classloader to hot-deploy the code changes made in a single Java class in the web applications to override the servlet container (JBoss or Tomcat) default WAR deploy behavior (which redeploys the whole web application context).

This tool helps the Java developers be more productive with the time they can save because of the less time required to load the class changes into JVM without having to deploy the whole web application every time a change is made in a single class.

Using the tool is pretty straight-forward. You will have to start the container (whether it's JBoss, Tomcat or any other J2EE container) using the "-javaagent" option and specify the folder(s) where JavaRebel should look for Java class changes in the web applications deployed in the container.

But, remember that even though JavaRebel helps boost the productivity with faster deployments of web application contexts, you should still design your applications to be more unit-testing friendly and be able to test most of the code in the application using the unit testing frameworks like JUnit4 or TestNG, outside the container. You should depend on the container only for those infrastructure concerns (like in-container Database Connection Pool, JTA Transactions, JMS Message Queues and Topics) that need the application to be deployed inside the container. Even in most of these cases, you can use the embedded broker version of ActiveMQ container to unit test the JMS resources outside the container.

If you are using JBoss or Tomcat or other application server and you are maintaining a legacy J2EE application that's not easy to unit test and requires the application to be deployed in the container for even simple code changes, you should check out JavaRebel tool. Similar to tools like IntelliJ IDEA, it is worth the price. The benefits it offers far out-weigh the cost.

I hope SpringSource or JBoss will soon acquire ZeroTurnaround to integrate JavaRebel into Tomcat or JBoss containers respectively. JavaRebel is such an useful tool it only makes sense to see it integrated with these popular J2EE containers and not as a separate product.

2 comments:

Shawn Hartsock said...

Thanks for the tip! This will come in very handy over the coming weeks. Good timing.

michaelvk said...
This comment has been removed by the author.