Search code examples
javaeclipsetomcatremote-debugging

Remote debugging on Tomcat with Eclipse


I'm trying to initiate a remote debugging session on my PC with Eclipse & Tomcat. I managed to run tomcat (not through eclipse) with the following params:

set JPDA_TRANSPORT=dt_socket
set JPDA_ADDRESS=5050
cataline jpda start

The server starts ok, this is the outcome:

Using CATALINA_BASE:   "C:\Java\Tomcat"
Using CATALINA_HOME:   "C:\Java\Tomcat"
Using CATALINA_TMPDIR: "C:\Java\Tomcat\temp"
Using JRE_HOME:        "C:\Java\jdk1.6.0_27"
Using CLASSPATH:       ...
Listening for transport dt_socket at address: 5050
...
...
INFO: Server startup in 12502 ms

Now, I opened eclipse, and loaded the relevant project.

I set a new debugging configuration using Remote Java Application with localhost and the right port. however when I run it, I get this error message:

Failed to connect to remote VM. Connection refused.
Connection refused: connect

Can't really understand where is the problem. this is all local inside the PC, so there shouldn't be any firewalls involved, can someone think of something ?


Solution

  • Found the solution. apparently the connection was made, but Eclipse & Tomcat don'tt show any notification or status regarding it. Then, when you initiate the connection again, you get the error because you're already connected.

    I think that a small notice, either from Eclipse, or from Tomcat would be nice.