DEV Community


Posted on • Originally published at

Failed to connect to remote vm. connection refused. connection refused: connect

Problem :
I am often facing the below error when I want to Debug from my Eclipse IDE.

Message: “Failed to connect to remote VM. Connection Refused”
How can I fix this error?

Solution :
In my case, I had to turn my Windows Firewall off

1- Open your Windows Firewall by just clicking the Start button Picture of the Start button, and then clicking the Control Panel. In your search box, just type firewall, and after that click on Windows Firewall.

2- Now just click on Turn Windows Firewall on or off. The Administrator permission required If you are prompted for the administrator password or the confirmation, type your password or provide the confirmation.

3- Click on Turn off Windows Firewall (not recommended by me) under the each network location that you are trying to stop the protection, and after that click on OK.

Sometimes you need the below steps also

To stop all the Vpn client services (fortiClient ,vpn Client ...)
To stop all the Antivirus Firewall ( exemple Kaspersky => Configuration => Anti-Hacker)

I am using the jboss so the solution to your problem is very simple just restart using the below command :

service jboss-portal restart

Another Solution:
In your debug configuration you'll have to identify the correct port of your server (GF:9009 / Tomcat:8000)

You'll have to place the JVM property of the server to debug

For Glassfish:

Log in to admin-console > Configurations > server-config > JVM-Settings > check DEBUG checkbox > restart server
For Tomcat:

make file debug.bat/.sh (depending on your OS) in %TOMCAT_HOME%/bin directory and write

set JPDA_TRANSPORT=dt_socket
catalina.bat jpda start
in it.

Afterward, you've made this file begin server by executing debug.bat/.sh.

Currently, you must be able to debug remotely in Eclipse after you fix the required properties in your debug configuration.

In case you're running tomcat in a Win environment as a service you don't have a catalina.bat file in the bin-directory of your tomcat installation.
For setting your server into debug-mode please attempt the following:

Run the Configuration option in Windows Menu or run
In the Java tab, include this line to Java:
I hope this will help you

Discussion (0)