Remote Debug Tomcat in Eclipse
Remote debugging is a must for web-applications. When a .war file is deployed in a web/jee container, we have no way to track where / how the application runs besides doing on screen (or file) prompts. But this is not an effective way; and REMOTE DEBUGGING is the key to overcome this mountain.
To do remote debug of tomcat via Eclipse, is simple and effective. You just have to takes some times to setting up your environment once, and you can benefits from it in later days.
Step 1: Edit catalina.out / catalina.sh
Add in the string in the catalina.out
set JPDA_TRANSPORT=dt_socket
set JPDA_ADDRESS=8787
This action is to add port in your tomcat when it starts, and the port number defined here is “8787” (This is the default debug port for tomcat)
Step 2: Add “Remote Java Application” in Eclipse’s Debug
Remember to set the port number as the 1 you set in Step#1 and hits “Debug” button
p/s: pls set your break-points before you do this remote debug configuration
Step 3: Starts Tomcat
Go to "../tomcat/bin"
, hits “cataline.out jdpa start
”
Yeah, the remote debug is started, you can see your bug clearly now!
Source: Tomcat FAQ
Leave a Reply