1

I am getting the following message when I try to remote debug a java application through eclipse. "Failed to connect to remote VM. Connection refused." What could be the error?

0

6 Answers 6

3

You need to invoke the process to be debugged with the appropriate options e.g.

-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044

(substitute with the appropriate port if necessary) and it sounds like the VM isn't listening on the configured port. You can use netstat /a to confirm if the VM is listening on that port (or telnet)

Sign up to request clarification or add additional context in comments.

1 Comment

When I tried netstat /a i got: TCP DEV-MACHINE2:8787 localhost:1261 ESTABLISHED This is the only entry for the port number 8787 which I an using.
2

For client debugging, I came across the same issue

URL -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=4081

Changing the port number solved the issue.

Comments

1

do you have port 8000, or whatever port you have configured for remote connections open on your firewall?

1 Comment

Right now I'm testing on my machine. So it won't be a problem right?
1

The remote application needs to be started first. Did you add the arguments to the target remote app so it will accept a debugging connection/

1 Comment

Sometimes the port hasn't been released from the last time it was ran. On Windows do a 'netstat -a' and look for the port the remote app is using to listen for debug connections. If it is still open, you won't be able to open a remote debug session. Close the port/socket or if it comes down to it, change the port used. Hopefully the first socket eventually releases before you lock up the second.
1

Make sure your JVM was started with these options

-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n

and that port 8000 is free

1 Comment

just do a netstat -an | grep 8000
0

With the newer JDKs you might also need to specify address=*:8000 so that it listens for remote connections.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.