I’m getting the following error when I start Debug from the Eclipse IDE. Message: “Failed to connect to remote VM. Connection Refused” What could be the reason?
+1
A:
Have you setup the remote VM to accept connections?
java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=10000,suspend=n yourServer
Is there a firewall in the way?
Are you specifying the correct host / port?
Glen
2009-06-10 12:58:54
A:
add to your run script:
export JPDA_ADDRESS=8787
export JPDA_ADDRESS=8787
export JPDA_TRANSPORT=dt_socket
export JPDA_HOST=localhost
JAVA_OPTS=$JAVA_OPTS -Xms128m -Xmx512m -Dsun.rmi.dgc.client.gcInterval=3600000
JAVA_OPTS=$JAVA_OPTS -Dsun.rmi.dgc.server.gcInterval=3600000
JAVA_OPTS=-Xdebug -Xnoagent -Xrunjdwp:transport=$JPDA_TRANSPORT,address=$JPDA_ADDRESS,server=y,suspend=n $JAVA_OPTS
lctr30
2010-04-22 14:00:58
A:
Our development image only has the Tomcat service installation on it, so setting the environment variables, etc., didn't have any effect. If you need to do this through the Tomcat Windows service, there are a few things you'll need to be aware of:
- David Citron's comment was the last bit that I needed to get my connection working. The hosts file on our machines has localhost commented out (it's supposedly resolved through the DNS, but that doesn't work for the debug connection). I uncommented it and was able to connect.
- If user access control is turned on, you'll need to use your admin credentials to access the services control panel or the Tomcat monitor app or whatever you're using to toggle the server state. The monitor app (documented here) is probably the best, because you can both edit the server settings for the debug options and start and stop the server.
- I thought that perhaps you would need to run Eclipse as an administrator to be able to terminate the Tomcat process, but you don't. Once you have that remote attachment, you're able to work with the service up to termination.