MaintainJ Blog

March 6, 2008

MaintainJ with Jetty

Filed under: Uncategorized — maintainj @ 10:51 am

MaintainJ introduction page says that runtime instrumentation is supported on Tomcat, JBoss, WebLogic and WebSphere only. Well, it is not entirely true. It just means that MaintainJ installation process is automated and tested on those servers. Please contact me if you are working on some other server and need support.

Here is how you can get MaintainJ runtime instrumentation work on Jetty.

I deployed MaintainJ.war to Jetty 6.1 running on JDK 1.5. In Step1, I entered C:\Programs\jetty-6.1.8\mnj as installation folder.

At the end of Step 2, the following instructions are shown:


Step 3: Update server settings and restart the server.

When your application is deployed directly to server:
Add the following to server classpath

Add the following (with quotes) to server JVM arguments


Updating classpath is a little tricky in Jetty. I copied the start.config file from JETTY_ROOT/start.jar to JETTY_ROOT and renamed it as startmnj.config . I added the following two lines at the beginning of classpath setting lines.


This would add MaintainJAspect.jar and C:/Programs/jetty-6.1.8/mnj/ folder (where the aspect is present) to server classpath.

Next, I re-started Jetty as follows:

java -javaagent:C:\Programs\jetty-6.1.8\mnj\aspectjweaver.jar -DSTART=startmnj.config -jar start.jar

Notice how I specified the javaagent JVM property and the new start configuration file. Now you are all set. Go to the MaintainJ installation verification page at http://localhost:8080/MaintainJ/verify.jsp and confirm that it is successful.

Follow the next steps to generate the trace files and the UML diagrams. The procedure will exactly be same when running Jetty on JDK 1.6 and very similar when running on JDK 1.4. With JDK 1.4, the javaagent JVM argument is not supported and you will have to pass some jar files as JVM arguments. The specifics will be displayed on the screen after MaintainJ installation Step 2.

Powered by WordPress