简体   繁体   English

无法连接到Eclipse中的VM

[英]Cannot connect to VM in Eclipse

I have suddenly begun getting this weird error when I try to debug any of my projects on Eclipse. 当我尝试在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. 重启Eclipse,重启计算机。
  2. Change hosts file in etc\\ - Remove the comments (#) sign before 2 lines namely, 在etc \\中更改主机文件 - 删除2行之前的注释(#)符号,

    127.0.0.1 localhost 127.0.0.1 localhost

    ::1 localhost :: 1 localhost

    and restarted. 并重新启动。

  3. Turned off all firewalls, restarted Eclipse and retried. 关闭所有防火墙,重新启动Eclipse并重试。 Still no luck. 仍然没有运气。

Somebody please help me, I'm going crazy. 有人请帮帮我,我疯了。

Thanks 谢谢

Sousa 索萨

I just found this: Avast! 我刚刚发现了这个: Avast! 2014 I have it, and so it fits. 2014我有它,所以它适合。 If you do as well, then that is probably your problem. 如果你这样做,那么这可能是你的问题。

I am using Mac and I ran into similar issue. 我正在使用Mac,我遇到了类似的问题。 I made the changes to /etc/hosts file earlier, which I have reverted now to make it as below :- 我之前对/ etc / hosts文件进行了更改,现在我已将其恢复为如下所示: -

    127.0.0.1       localhost

And restarted the system and fixed my issue. 并重新启动系统并修复了我的问题。

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. 我完全从我的系统中卸载了Eclipse和Java。

I then re-installed the latest version of Java (I had this same version previously too). 然后我重新安装了最新版本的Java(之前我也有同样的版本)。

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). 然后我重新安装了Eclipse(最新版本)。

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. 但我不明白如果没有触及任何东西,这怎么可能发生。

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. 我认为问题是因为你已经设置错误的路径jre .try右键单击你的项目并单击运行配置并设置jre正确的路径。 Could you please elaborate more about the issue. 你能详细说明一下这个问题吗?

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. 事实证明我已经更改了我的/ etc / hosts文件,其中ip地址127.0.1.1被注释掉了。 After uncommented it, it started to work again. 取消注释后,它又开始工作了。

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. Simply restart your PC,它听起来很傻,但大部分时间都可以使用。我的电脑里没有avast,但仍然遇到了这个问题。

Just restarted my PC and debug worked, I'm not sure what might be the problem exactly though. 刚重启我的电脑和调试工作,我不确定究竟是什么问题。

disable windows firewall and it's OK. 禁用Windows防火墙,没关系。 TESTED. 测试。

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! 我建议你关掉你的AVAST! FIREWALL and restart your system and then try debug your application. FIREWALL并重新启动系统,然后尝试调试您的应用程序。 It will work fine. 它会工作正常。

Thanks Lokesh 谢谢Lokesh

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. 对我来说,启动jetty-server时遇到了这个问题,我的Windows 7 64位PC安装了McAfee Antivirus Protection软件,正如其他人提到的那样,我将防火墙选项重新启动并重新启动eclipse工作区并再次启动服务器。 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. 如果找到更新,会发布更新。

I had a similar problem, when working with scrapbook. 使用剪贴簿时,我遇到了类似的问题。 Fireval was in game mode. Fireval处于游戏模式。 Then I turned off Fireval and scrapbook began to work. 然后我关闭了Fireval,剪贴簿开始工作。

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'). 原因是我的/ etc / hosts文件中出现了一行无效的行(我在那里添加了虚拟网卡的IP,并将其转换为'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. 对于具有C背景的人来说,当您调试本地Java应用程序时,Eclipse读取/ etc / hosts有点令人惊讶,但似乎是这种情况。

如果您使用的是Windows操作系统,也许这个命令可以帮助您:

netsh winsock reset

I got this: Unable to launch scrapbook VM com.sun.jdi.connect.TimoutException 我得到了这个:无法启动剪贴簿VM com.sun.jdi.connect.TimoutException

I shut down Eclipse, disabled the Avast! 我关闭了Eclipse,禁用了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. 防火墙(建议但仅持续10分钟),重新启动Eclipse,此时我从Windows防火墙收到有关阻止某些Eclipse功能的消息。 I checked the "public networks" checkbox (I'm on an employer provided network through wifi), restarted Eclipse and "voila", it is working again. 我检查了“公共网络”复选框(我在雇主提供的网络上通过wifi),重新启动Eclipse和“瞧”,它再次工作。

Windows Firewall Notification - Screen grab Windows防火墙通知 - 屏幕抓取

In my case, it was a matter of running Eclipse as Administrator. 就我而言,这是以管理员身份运行Eclipse的问题。 Once I did that, problem solved. 一旦我这样做,问题就解决了。

In my case on a Mac, the "debug attach" block in launch.json was set to port 0. 就我的情况而言,在Mac上, launch.json"debug attach"块被设置为端口0。

I simply changed it to something else (8899), and it worked. 我只是把它改成别的东西(8899),它有效。

My debugger was timing out before the test connected to the JRE. 我的调试器在测试连接到JRE之前超时。

I increased my java/debug 'debuggger timeout' setting and was able to run the test. 我增加了我的java / debug'debuggger timeout'设置,并且能够运行测试。

Reference: 参考:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Eclipse:本地调试(非远程)“无法连接到VM” - Eclipse: Local Debug (not remote) “Cannot connect to VM” Eclipse Oxigen5 - “无法连接到非套接字上的 VM 套接字操作:configureBlocking” - Eclipse Oxigen5 - "Cannot connect to VM Socket operation on nonsocket: configureBlocking" Eclipse 在调试模式下启动时显示无法连接到 VM 错误 - Eclipse when launching in debug mode show Cannot connect to VM error 远程调试Eclipse:无法连接到远程VM - Remote Debugging Eclipse : Failed to connect to remote VM Eclipse错误:“无法连接到远程VM” - Eclipse Error: “Failed to connect to remote VM” 无法在Eclipse中调试简单的Java应用程序。 无法连接到虚拟机。 AGENT_ERROR_TRANSPORT_INIT(197) - Unable to debug simple Java application in Eclipse. Cannot connect to VM. AGENT_ERROR_TRANSPORT_INIT(197) 无法使用调试器(无法连接到VM) - Unable to use the debugger ( Cannot connect to VM ) Eclipse在调试模式下启动Weblogic错误:“无法连接到远程VM” - Eclipse Start Weblogic in debug Mode error : “Failed to connect to remote VM” Eclipse RCP应用程序不能同时使用-vm和-console吗? - Eclipse RCP Application cannot use -vm & -console together? 无法使用Java从VM连接到mysql数据库 - Cannot connect to mysql database from VM using java
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM