Hello all,
I wanted to share my experiences with running web applications with
m2e-wtp and Webby combined with JRebel [1]
JRebel is a tool that enhances JVM Hot Swap mechanism, so that most
changes can be applied dynamically to classes already loaded in memory.
It aims to fix the very common problem in J2EE application development -
unacceptably long time between introducing a change in the code and
seeing the result in a running application.
It is a commercial tool, but the price is reasonable and free licenses
for OSS projects are available.
JRebel is available both as a standalone application that plugs into JVM
using javaagent mechanism, and as pulgins for Eclipse, IDEA and NetBeans.
First, I've tried m2e-wtp + JRebel Eclipse plugin. The installation went
smoothly, and I was able to enable JRebel agent for the Tomcat server
that I used as the target for m2e-wtp assembled webapp.
I've run into a minor problem - disabling automatic publishing from WTP
server UI did not work, I had to edit server.xml by hand. This is
probably not related to neither m2e-wtp nor JRebel.
The application startup was considerably slower than without JRebel - I
expected that because classes had to be instrumented. Reloading changes
in the code worked as advertised, however build times after changing a
single Java source file were very noticeable - about 5s. This certainly
depends on the speed of the machine and size of the application, so your
mileage may vary.
Then I decided to try JRebel with Webby. I've uninstalled m2e-wtp (and
most WTP also) and installed Webby. Of course Webby run configuration
editor does not have JRebel tab, but I'm sure one could be added as an
optional extension if there's interest from the community.
Fortunately standalone JRebel can be plugged in very easily. In the JRE
/ VM arguments for a Webby launch configuration, I've added the following:
-javaagent:${env_var:JREBEL_HOME}/jrebel.jar
-Dworkspace.root=${workspace_loc}
This way I could share the configuration with other people on my team.
workspace.root system property is used in rebel.xml configuration file,
that specifies the filesystem location of the classes that need to be
monitored and reloaded on demand by JRebel.
I've placed this file in src/main/resources folder in my top level
webapp module and it looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.zeroturnaround.com"
xsi:schemaLocation="http://www.zeroturnaround.com
http://www.zeroturnaround.com/alderaan/rebel-2_0.xsd">
<classpath>
<dir name="${workspace.root}/coral-api/target/classes"/>
<dir name="${workspace.root}/coral-browser/target/classes"/>
...
</classpath>
</application>
I am not using any <web> tags, because Webby takes care of providing the
J2EE container with up to date resource files.
With this configuration I was able to achieve reasonable startup time -
Webby is really much faster than WTP, and also excellent build times -
below 1s. Everything worked very smoothly. I was able to code and see
the results with barely any latency at all! Compared to m2e 0.12 + WTP
the boost is incredible :)
cheers,
Rafał
[1] http://www.zeroturnaround.com/jrebel/
_______________________________________________
m2e-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/m2e-users