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

后端 未结 4 730
失恋的感觉
失恋的感觉 2020-12-08 17:02

I\'ve not built a Java web application before, but I have it complete enough to test and Maven is building my WAR file just fine. It is a multi-module Maven project and the

4条回答
  •  悲哀的现实
    2020-12-08 17:50

    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.

提交回复
热议问题