Saturday, April 10, 2010

How to remote debug Tomcat server code?

Either you are a developer of Tomcat or you would like to see how the Tomcat works in a live mode, you may want to set a few break points in the Tomcat codes and to see the code in the live run. How could you set up remote debug for tomcat? Thanks for the JPDA(Java Platform Debug Architecutre) we can easily achieve this goal.
  • Start tomcat server with remote debug enabled with JVM parameters: -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y and make sure you setting suspend=y to let the tomcat server suspend and wait for debugger to attach to it.
  • Start your debugger, I am using Intellij Remote Debug, and here is the settings: Host: localhost Port: 8000
That is all. Happy debugging.

No comments: