Remote Debugging Tomcat
February 1, 2018
It's possible to startup Tomcat in such a way that you can connect to it from a remote debugger, say the one within Eclipse. This example is for Windows based development.
To do this we need to set some options in the startup batch file:
set JPDA_ADDRESS=8000 set JPDA_TRANSPORT=dt_socket set JAVA_OPTS=-Doracle.jdbc.Trace=true -Xmx1024m -XX:PermSize=64M -XX:MaxPermSize=128M echo Using JPDA_ADDRESS: %JPDA_ADDRESS% echo Using JPDA_TRANSPORT: %JPDA_TRANSPORT% bin\catalina jpda start
One this is run up, it'll be listening on port 8000. Within Eclipse you can select the option to debug a remote JVM, and then connect to it. You will be able to use the normal features of the debugger including breakpoints, inspecting variable values, and stepping through the code.