tags:

views:

138

answers:

4

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?

+1  A: 

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

yx
Right now I'm testing on my machine. So it won't be a problem right?
iJeeves
no, it shouldn't be a problem if its on the same machine...
yx
+1  A: 

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/

Kelly French
yes, I did started the remote appln.
iJeeves
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 French
+2  A: 

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)

Brian Agnew
When I tried netstat /a i got: TCP DEV-MACHINE2:8787 localhost:1261 ESTABLISHEDThis is the only entry for the port number 8787 which I an using.
iJeeves
+1  A: 

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

Murali VP
How to check if the port is free..
iJeeves
just do a netstat -an | grep 8000
Murali VP