Remote debugging of tomcat using eclipse

Datetime:2016-08-23 03:54:44          Topic: Tomcat           Share

If you are running tomcat on a remote machine and you want to debug the application running on the remote tomcat using eclipse on your local machine then this is the guide for you.

Configure tomcat

The first step would be to add the following properties to the setenv.sh in the tomcat/bin/ folder. This file doesn't exist by default in tomcat 7 so you may have to create this file and give appropriate user rights:

export CATALINA_OPTS="$CATALINA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"

You can change the port by changing the value of the address attribute above.

Configure  Eclipse

And in the eclipse the following screenshots would show you how to connect:

1. Go to the run menu in eclipse and click the Debug Configurations menu as shown in below screenshot.

2. You would see the Debug Configuration dialog as shown in below

3. Select the Remote Java Application in the dialog and you will the below dialog

3. Fill the dialog:

  • Name : enter the name you like, a name you remember to which tomcat you are connetiing
  • Project: would be the workspace project you want to act as source project for debugging.
  • Connection Type: Choose Standard (Socket Attach)
  • Connection properties: 
    • Host is the name or IP of the remote machine 
    • Port is the port you configured above in the tomcat setenv.sh
  • If you have to add more than  one project as the source folder go to the source tab and add the project you want

Once you have followed the above steps, you should be able to debug the remote app using your eclipse.

If you want to find out about memory leaks please refer to this guide

http://technicalblogon.blogspot.ch/2015/12/jconsole-guide-for-simple-connection.html




About List