Search code examples
javaeclipsejarremote-debugging

Eclipse connection refused when remote debugging


I've been following this tutorial which is how to setup remote debugging. I have my Jar running debug mode listening on port 6065 on my server with the following setting:

-Xrunjdwp\:transport\=dt_socket,server\=y,address\=6065,suspend\=n

I start the JAR on my server with jar in debug mode with:

myApplicationThatContainsJar.exe -debug "my application"

>     Now Starting JVM
>     Listening for transport dt_socket at address: 6065

I have psping tool installed which I use to ping (IPaddress:port). I am able to ping my ipaddress example: 44.66.33.66:6065 from my dev box and get a reply. But when I try to initiate remote debug in Eclipse I get:

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

I have verified I've added permission for both inbound and outbound traffic for that port on both my DEV box and server.

When I start my JAR on my server and before I try to connect with Eclipse I do a:

psping 44.66.33.66:6065 

And I get a response stating that it sent and recieved with 0% loss, meaning I am indeed getting a response.

In the eclipse debug configuration, which in the 'Debug Configurations' window I have the host and port listed properly and the 'Connection Type: Standard(Socket Attach)'.

As soon as I try to connect with Eclipse and get the connection refused error I try psping again from the command line, but now eclipse did something to the connection and I get in the command line:

The remote computer refused the network connection.

Any suggestions where else I should check? or where else I should troubleshoot? I'm trying to do remote-debugging for my JAR from the DEV box to my server.


Solution

  • -Xrunjdwp\:transport\=dt_socket,server\=y,address\=6065,suspend\=n
    

    should be:

    -Xrunjdwp\:transport\=dt_socket,server\=y,address\=6065,suspend\=y
    

    notice the suspend\=y keep in mind I need to escape the equals and others may not need to do this. Once I set to suspend\=y the application waited for me to connect from eclipse and I was able to begin remote debugging.

    Don't forget to open inbound and outbound traffic for the port you used for address\=6065