2

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 ?

stdcall
  • 27,613
  • 18
  • 81
  • 125
  • 1
    it could still be the firewall, try to disable it, and see – stivlo Nov 07 '11 at 17:17
  • no, I checked... it's not the firewall... – stdcall Nov 07 '11 at 17:18
  • `cataline jpda start` looks strange. Typically it is called `catalina`. Are you sure you are running good script? – AlexR Nov 07 '11 at 17:20
  • 2
    ok, if you do "telnet localhost 5050" does it work? – stivlo Nov 07 '11 at 17:20
  • try run just `catalina jpda start` and connect to port 8000. Without your own scripts, variables etc. I hope it will work. If yes, continue discovering why your port 5050 does not work. – AlexR Nov 07 '11 at 17:23
  • Haven't debugged Tomcat for a while, but maybe take a look at [this](http://www.eclipsezone.com/eclipse/forums/t53459.html). Don't remember if specifying address and transport is sufficient. As you see there are some additional options such as `server=y,suspend=n`. Also, I think that you could enable Tomcat debugging through *admin console* (which is much safer than modifying startup script). – jFrenetic Nov 07 '11 at 17:24
  • is your debug profile set to Socket Attach or Socket Listen? – mcfinnigan Nov 07 '11 at 17:24
  • check if this helps: http://stackoverflow.com/questions/3835612/remote-debugging-tomcat-with-eclipse – stivlo Nov 07 '11 at 17:34
  • @mcfinnigan - it is set to attach – stdcall Nov 07 '11 at 17:38

4 Answers4

4

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.

stdcall
  • 27,613
  • 18
  • 81
  • 125
0

There could be problems when there are code mismatches between eclipse and tomcat. So when it matches the error will disappear

Sumukh
  • 660
  • 7
  • 11
0

You can configure it in remote java application section in debug configuration. For more details you can refer this link

Balkrushna Patil
  • 418
  • 6
  • 12
0

Try adding the following debug options directly to the JVM startup by directly modifying the catalina startup script

-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5050
Drona
  • 6,886
  • 1
  • 29
  • 35