The short answer is to add the following options when the JVM is started:
-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
Comments: this 8000 port is just for debugging, user can still access server by 80 port(if set)
How do I remotely debug Tomcat using Eclipse?
Make sure that you have the sources for the code that you are trying to debug in your IDE. For the libraries and for Tomcat itself you can "attach" the sources to the jar files: open a class file and then click "Attach Source..." button.
- If you have a servlet or something, set a breakpoint where it is sure to hit on the next request.
- Go to "Run->Debug Configurations...". Click on "Remote Java Applications", then click "New". Type in the title. Note that port 8000 from the Tomcat instructions. Save and run.
- Eclipse will connect to the JVM that Tomcat is running under. Wow, that was easy!
Comments
Post a Comment