Thursday, March 6, 2008

Remote debugging Apache Tomcat in Fedora with Eclipse



To remote debug a Eclipse project which has deployed in Apache tomcat we need to do following steps.

1. Set the Environment Variables for remote debugging in .bash_profile of Fedora
2. Run Apache tomcat in Remote debugging mode
3. Run Eclipse in Remote debugging mode

So lets look at how we are going to do above steps.

Step 1: Setting up the Environment Varibles for remote debugging in .bash_profile of Fedora

JPDA_ADDRESS=8000
JPDA_TRANSPORT=dt_socket


Step 2: Run Apache Tomcat in Remote debugging mode

To run apache tomcat in remote debugging mode you need to type following additional commands at the end of the starting command

sh $tomcat_home/bin/catalina.sh jpda run

Then we can see that it is listening to the port you have configured in the .bash_profile, Following shows the port which i have configured to listen on tomcat.

Listening for transport dt_socket at address: 8000

Step 3: Run Eclipse in Remote debugging mode

To debug remote debugging in eclipse you need to follow following steps.

1. run -> open debug dialog -> Remote Java Application
2. Add the project which you are going to debug. This project needs to be deployed in the tomcat and the source codes should be exactly same otherwise debugging will do miscellaneous things like debugging comment, space etc
3. Then set the connection properties. The port should be same as the above ports
4. Then press start debugging. Before starting the project you need to start Tomcat.
5. Start the tomcat deployed web application until you reach the debugging point you have declared in the Eclipse
6. When you reach that point then it will ask Eclipse to switch to debugging view.

No comments: