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?
5 Answers
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
)

- 268,207
- 37
- 334
- 440
-
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. – softwarematter Nov 10 '09 at 18:38
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.

- 18,436
- 13
- 66
- 75
do you have port 8000, or whatever port you have configured for remote connections open on your firewall?

- 7,130
- 3
- 40
- 68
-
Right now I'm testing on my machine. So it won't be a problem right? – softwarematter Nov 10 '09 at 18:39
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/

- 12,198
- 10
- 63
- 93
-
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. – Kelly S. French Nov 11 '09 at 15:35
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

- 6,198
- 4
- 28
- 36