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_ADDRESS=8000
    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:

  1. Run the Configuration option in Windows Menu or run
  2. In the Java tab, include this line to Java:

I hope this will help you

More Posts

Curl: (7) failed to connect to localhost port 9200: connection refused Alecxe01 - Nov 22
How to run a java program in Eclipse MallikaShaik672 - Oct 21, 2020
how to open a java project in eclipse Hasnain_khan - Oct 13, 2020
Process finished with exit code 0 java Naymul01 - Oct 23
Starting tomcat server at localhost has encountered a problem. john_dev - Sep 20
Eclipse error java was started but returned exit code 13 amna - May 17
No rule to make target c++ Naymul01 - Oct 21
How to create a jsp page in eclipse amna - Jul 25
How to change background color in eclipse amna - Jul 3
#2002 - no connection could be made because the target machine actively refused it. Farkhanda Athar - Apr 15, 2020