Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse : Failed to connect to remote VM. Connection refused. [duplicate]

When ever i tried to launch my eclipse debug(for server side code) i'm getting the following error Failed to connect to remote VM. Connection refused.

What's the problem may be? I already tried with most of the solutions out in the web but none of that solved my issue. Could any one can assist me to fix this? Advance thanks..

like image 916
Arung Avatar asked Mar 08 '12 16:03

Arung


People also ask

How do I fix failed to connect to remote VM Connection refused in eclipse?

1- Open Windows Firewall by clicking the Start button Picture of the Start button, and then clicking Control Panel. In the search box, type firewall, and then click Windows Firewall. 2- Click Turn Windows Firewall on or off.

How do I fix resolve failed to connect to remote VM connection refused?

Just restart the Java application in debug mode. One of the human error which causes "Failed to connect to remote VM. Connection refused". Some time typo on hostname or port causes Eclipse trying to connect different servers or a different port, which is an obvious reason you get this error.

How do I get debug view in Eclipse?

If Eclipse does not automatically switch to the Debug perspective, you can locate it manually in the Window entry on the menu bar or by clicking the Choose Perspective button (a button with a plus on it) in the upper right corner of the Eclipse window under the menu bar line.


2 Answers

when you have Failed to connect to remote VM Connection refused error, restart your eclipse

like image 149
Subbiah Sudhan Avatar answered Oct 04 '22 10:10

Subbiah Sudhan


Which server are you using?

Like already said:

  1. In your debug configuration you'll have to define the right port of your server (GF:9009 / Tomcat:8000)
  2. You'll have to set 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:

create 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.

After you've created this file start server by executing debug.bat/.sh.

Now you should be able to debug remotely in Eclipse after you set the necessary properties in your debug configuration.

Hope this helped! Have Fun!

EDIT

If 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.
To set your server into debug-mode please try the following:

  1. Run the Configuration option in Windows Menu or run %catalina_home%/bin/tomcat6w.exe
  2. In Java tab, add this line to Java:

options:-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n

like image 32
SimonSez Avatar answered Oct 04 '22 10:10

SimonSez