Remote debugging Tomcat with Eclipse

Today I tried to use remote debugging with Eclipse and Tomcat.
I usually use a Tomcat Sysdeo Plugin to run Tomcat inside Eclipse, but today I faced remote debugging.
To run tomcat in remote debugging you can start it with command
catalina jpda start

But this will start remote debugging using shared memory, and Eclipse, as far as I know, does not support shared memory as transport for deubugging.
The alternative is to use a socket as transport for JPDA.
You simply set some enviroment variable that will be checked by catalina startup script, as in following example:

set JPDA_TRANSPORT=dt_socket
... then you can run ...
D:\Java\jakarta-tomcat-5.5.7\bin>catalina jpda run
D:\Java\jakarta-tomcat-5.5.7\bin>catalina jpda start

This tells catalina script to use socket transport for debugging and to listen on port 5050. If you don't specify the port, it will be assigned randomly.
When you start tomcat, you'll see some messages on console saying that debugging socket is listening:

D:\Java\jakarta-tomcat-5.5.7\bin>catalina jpda run
Using CATALINA_BASE:   D:\Java\jakarta-tomcat-5.5.7
Using CATALINA_HOME:   D:\Java\jakarta-tomcat-5.5.7
Using CATALINA_TMPDIR: D:\Java\jakarta-tomcat-5.5.7\temp
Using JAVA_HOME:       d:\Java\jdk1.5.0_04
Listening for transport dt_socket at address: 5050
4-ott-2005 18.26.11 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
4-ott-2005 18.26.11 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1162 ms
4-ott-2005 18.26.11 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
4-ott-2005 18.26.11 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.7
4-ott-2005 18.26.11 org.apache.catalina.core.StandardHost start

Now it's time to connect to that socket using Eclipse: see following picture.

Eclipse Remote Debugging

On "Connection Properties" you can configure a remote VM that you want to debug. Then place your breakpoints and run the shown launch configuration.
Shared memory is easier to be used: with tomcat you don't have to set up environment variables, and for IDE supporting it (I used this with IntelliJ), you only need to specify the name of the shared space. This won't work if the VM to debug is on a remote computer but can be helpful anyway. I tried to find shared memory support in Eclipse but I didn' find it, and I believe it doesn't have.
Remote debugging is more useful when you have to attach to a running instance on a remote server on which the bug is alive. Shared memory support lack is not that problem.

One thing that you cannot do running programs inside Eclipse under Windows is to get a Thread dump. On Windows you can get a Thread Dump pressing CTRL+Break in the DOS console, but this doesn't work on Eclipse console. On Linux you can use "kill -3", and I think this work even running processes in Eclipse. Maybe it's possible also in Windows, using some esotic tool, but I don' know... also I don't know if Windows supports several kill signals.

19 Responses to “Remote debugging Tomcat with Eclipse”  

  1. 1 ravi

    the steps and the explanation provided are very vague. isnt there a site that gives a detail view into the issue.

    i m trying to debug a tomcat in the linux box from a win xp box. when i put the paramters as specified here the tom cat doesnt start up at all.! any ideas

    do we need to include some jar in classs path or any other??


  2. 2 Richard

    At last I can remote debug my web app in tomcat 5.5 with eclipse – why are these options not made more visible or scripted? so simple when running under JBoss but tomcat on its own seems to make life that little bit more difficult.

  3. 3 bagman

    Excellent post! I am doing schoolwork with eclipse ganymede and the buggy bitch will not deploy my project properly to the internal server and will not connect to the internal server even tho it seems to be running. Matter of fact it will not connect to any web service internally: can’t access help either. I love eclipse 18M lines of code delivered on time and full of bugs.

  4. 4 DMM


    That was very helpful. Better than all publications on debugging i see lately.


  5. 5 Pedro75

    Hi I used your procedure to debug a webservice (axis2 and tomcat). I installed breakpoint on sekeleton (webservice side) but I receive this message: “Unable to install breakpoint in ‘project name’ due to missing line number attributes…”

    I checked on eclipse window/preference/java/compiler and all the options are correctly flagged.

    Can anyone help me?


  6. 6 Luigi

    Hi Pedro.

    Probably your class files are compiled without debugging information. Ensure that javac (java compiler) is not invoked specifying any option to suppress debug informations in class files. Check also ant/maven or the other tools you are using to compile your classes. Definitely the problem is in the class files.

  7. 7 pedro75

    Hi Luigi, I check my build.xml file (I generate the .class by ant) as you suggested and tag had the field debug=”false”. Now this field is “true” and all works: now I can debug in remote… Thank you very much….

  8. 8 Paul

    Thanks, that was very helpful !!!

  9. 9 Shivam

    Excellent post..I was able to debug my stuff.Keep it up..

  10. 10 vishu


    Is is possible that at a time more than one person can do remote debugging on same server machine ???
    If yes , please tell me how can we do this… my id…

  11. 11 raks


    I try to apply to my program but I have a connection timed out when I run the remote application.

    Here is what I do:
    1) In Eclipse, I open the menu Debug Configurations, I add the argument: « -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8080 » on the Tomcat.
    2) I run Tomcat in debug mode
    3) I create a new Remote Application (Host : localhost Port : 8080)
    4) I open internet and type the address http://localhost:8080/eurogesTrunk/ to run my application
    5) I run my application
    6) I run the remote application

    Et after a few seconds, I have a connection timed out.

    Can you help me?

  12. 12 Santhosh
  13. 13 Qun

    The info is elpful to me, especially the way to check if tomcat is started correctly with debug on. Thanks!

  14. 14 Durga Prasad

    For enabling the remote debugging of Tomcat webapplication from a local eclipse, set the following in the properties.


  15. 15 ramu

    I try to apply to my program but I have a connection timed out when I run the remote application.


    Actually your tomcat is running with low amount of time so u extend the tomcat server time.

  16. 16 McNought

    A usefull addition was this batch:

    set JPDA_TRANSPORT=dt_socket

    set JPDA_ADDRESS=5050

    catalina jpda start

  1. 1 关于Eclipse和IntelliJ IDEA整合Tomcat调试 - Kappa’s fresh life
  2. 2 Fare il debug di web services « Software Libero e non solo
  3. 3 Remote debugging Tomcat with Eclipse – NewInstance | ilSanto's Blog

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


October 2005
« Sep   Nov »

Follow me

twitter flickr LinkedIn feed

Subscribe by email

Enter your email address:



Tag Cloud