Cannot connect to VM in Eclipse
Asked Answered
T

18

15

I have suddenly begun getting this weird error when I try to debug any of my projects on Eclipse. I don't remember changing anything for this problem to start so suddenly.

'Launching <my program name>' has encountered a problem.
Cannot connect to VM.

Details of the error:

Cannot connect to VM
com.sun.jdi.connect.TransportTimeoutException

Further, in the console I get the following error:

FATAL ERROR in native method: JDWP No transports initialized, 
jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
ERROR: transport error 202: connect failed: Connection timed out
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized     
[../../../src/share/back/debugInit.c:750]

Please tell me how to solve this problem. I have searched the whole web for an answer but to no luck.

I tried the following solutions which worked for other people:

  1. Restarted Eclipse, restarted computer.

  2. Change hosts file in etc\ - Remove the comments (#) sign before 2 lines namely,

    #127.0.0.1 localhost #::1 localhost and restarted.

  3. Turned off all firewalls, restarted Eclipse and retried. Still no luck.

Tetragram answered 28/10, 2013 at 11:24 Comment(0)
S
7

I am using Mac and I ran into similar issue. I made the changes to /etc/hosts file earlier, which I have reverted now to make it as below :-

    127.0.0.1       localhost

And restarted the system and fixed my issue.

Serilda answered 7/4, 2017 at 21:34 Comment(0)
T
3

After much stress and a lot of time, the problem is now resolved. Albeit in a very freaky way which does not amuse me as I can't figure out the rationale behind it. Anyways, here is what happened and maybe someone can throw some more light on what could have been the root cause of the problem.

I uninstalled Eclipse and Java completely from my system.

I then re-installed the latest version of Java (I had this same version previously too).

But this time I installed it in the standard directory and not the custom directory that I was using before (Probably something here was wrong the first time).

I then re-installed Eclipse (latest version again).

And just like that, it all started working normally again, Debug mode and everything!

What immediately comes to my mind is that the system environment variables could have got changed somehow. But I don't understand how this could have happened without me touching anything.

Tetragram answered 4/11, 2013 at 15:55 Comment(0)
P
2

I think the problem is because you have set the wrong path to jre .try right click on your project and click run configuration and set jre correct path. Could you please elaborate more about the issue.

Poulin answered 28/10, 2013 at 11:32 Comment(1)
But in case the problem was with the jre path, it would have occurred always right? The problem I face is that it all of a sudden started occurring.. I don't remember making any change before it started occurring.. I'm thinking maybe something updated automatically on my computer because of which it does not run anymore? I don't know.. I have been working in Eclipse and on the same project file for weeks and nothing like this has happened before..Tetragram
I
2

I ran into the same problem. It turned out that I have changed my /etc/hosts file where the ip address 127.0.1.1 was commented out. After uncommented it, it started to work again.

Intone answered 27/5, 2014 at 5:15 Comment(0)
G
1

disable windows firewall and it's OK. TESTED.

Gagger answered 15/1, 2014 at 9:21 Comment(0)
S
1

Simply restart your PC, it sounds silly but works most of the times., I don't have avast in my PC, but still ran into this problem.

Just restarted my PC and debug worked, I'm not sure what might be the problem exactly though.

Sadick answered 11/6, 2014 at 13:51 Comment(0)
D
1

My debugger was timing out before the test connected to the JRE.

I increased my java/debug 'debuggger timeout' setting and was able to run the test.

Reference:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=123118

Daphene answered 26/2, 2019 at 17:46 Comment(0)
S
0

Sometimes when you try to debug your application, you will get the error like

Cannot connect to VM 
com.sun.jdi.connect.TransportTimeoutException
FATAL:----------
ERROR:------------
ERROR:----------
WARN:-------------

I suggest you to turn-off your AVAST! FIREWALL and restart your system and then try debug your application. It will work fine.

Sputum answered 24/2, 2014 at 8:30 Comment(1)
you don't need to restart your machine! just disabling the firewall.Weaner
G
0

For me I had this issue when starting up the jetty-server and McAfee Antivirus Protection software was installed in my Windows 7 64 bit PC and as other mentioned I diabled the Firewall option and restarted eclipse workspace and started the server again. It worked!!!

Listening for transport dt_socket at address: 9000

I doubt there is a way to enable the port without disabling the firewall or maybe whitelist the specific port to be allowed by my antivirus softwares since this wont change often. Will post an update if I find one.

Gentilis answered 5/3, 2015 at 12:13 Comment(0)
M
0

I had a similar problem, when working with scrapbook. Fireval was in game mode. Then I turned off Fireval and scrapbook began to work.

Mohun answered 15/4, 2015 at 12:13 Comment(0)
B
0

Same symptoms appeared quite suddenly after my setup had worked nocely for long time. The reason appeared one invalid line in my /etc/hosts file (I had added virtual NIC's ip there with translation to 'localhost'). Removing that line fixed it.

For someone with C background it is bit surprising that Eclipse reads /etc/hosts when you are debugging local Java application, but that appears to be the case.

Brassiere answered 1/5, 2015 at 19:31 Comment(0)
P
0

If you use a Windows OS, maybe this command can help you:

netsh winsock reset
Portative answered 8/5, 2015 at 3:24 Comment(2)
Can you explain why this would help with the OP's problem?Retroact
I installed a earch engine soft named everything , then eclipse debug can not work, console show: Cannot connect to VM, reset Winsock ,slove it.Portative
T
0

I got this: Unable to launch scrapbook VM com.sun.jdi.connect.TimoutException

I shut down Eclipse, disabled the Avast! firewall (as recommended but only for for 10 minutes), restarted Eclipse at which point I got a message from the Windows firewall about having blocked some Eclipse features. I checked the "public networks" checkbox (I'm on an employer provided network through wifi), restarted Eclipse and "voila", it is working again.

Windows Firewall Notification - Screen grab

Timepleaser answered 20/2, 2017 at 1:43 Comment(0)
G
0

In my case, it was a matter of running Eclipse as Administrator. Once I did that, problem solved.

Galla answered 18/5, 2017 at 13:15 Comment(0)
B
0

In my case on a Mac, the "debug attach" block in launch.json was set to port 0.

I simply changed it to something else (8899), and it worked.

Bontebok answered 15/3, 2018 at 16:35 Comment(0)
T
0

I fixed it by increasing these settings

enter image description here

Tergal answered 12/7, 2021 at 23:2 Comment(0)
A
0

In my case it worked just by disabling the word wrap setting on the eclipse console

Antimissile answered 10/11, 2022 at 22:43 Comment(0)
L
0

I deleted an extra module file and it worked. This module is created automatically with my 'Main.java'.

Lip answered 14/3, 2023 at 13:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.