Category: debug

Remote debug a Tomcat Webapp

When developing a Tomcat web application I use the tomcat:deploy and tomcat-redeploy Maven targets to publish a new version of the webapp towards Tomcat. Not using
an IDE plugin which automatically connects to Tomcat forces me to do it manually. This is pretty easy!

catalina.sh / catalina.bat startup script

You can use the the catalina.sh (on Linux) or catalina.bat (on Windows) to control how Tomcat starts up. This script can be found in the bin folder of your Tomcat installation. Add the parameters jpda start to the script to start Tomcat
in its debug mode. In Windows, the complete command is:

catalina.bat jpda start

Under Linux it is:

./catalina.sh jpda start

Debugging

On startup Tomcat should now show a message similar to:

Listening for transport dt_socket at address: 8000

This means that Tomcat has started and listens at port 8000 for remote debug connections. You can now use your Java IDEs Remote Debug capabilities to connect remotely and set breakpoints and such in your IDE.

Leave a Comment