Best way to debug Java web application packaged as a WAR using Eclipse and Maven?

If you run your WAR with tomcat/jetty plugin pass debug options to the Maven:

export MAVEN_OPTS="-Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000" mvn tomcat:run

If you run your WAR using the regular Tomcat, just run it with JPDA (debugger) support enabled:

$TOMCAT_HOME/bin/catalina.sh jpda start

Default port for Tomcat 6 JPDA is 8000.

Now connect with the Eclipse (Debug -> Remote Java Application) to the port 8000 and enjoy your fine debugging session.

Leave a Comment