Wednesday, February 4, 2009

Debugging Java web applications

Debugging Java web applications is often necessary, but setting it up on different vendors can be difficult.
However, there is a generic, easy way to do this by setting the JVM running the web server in debug mode.

Jetty and Maven



export MAVEN_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n"
mvn jetty:run

Set up your IDE for remote debugging on port 4000 and you're laughing!
idea-remote-jetty-debugging