无法使用 Eclipse 在 Java 中进行调试 [英] Unable to debug in Java with eclipse

查看:31
本文介绍了无法使用 Eclipse 在 Java 中进行调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Eclipse 作为 IDE 在我的机器上调试一个简单的 Java 应用程序.当我尝试通过进入 Debug Perspective 来调试应用程序时,我设置了一个断点并开始调试.几秒钟之内,弹出如下窗口:

I am trying to debug a simple Java application on my machine using Eclipse as an IDE. When I try to debug the application by entering the Debug Perspective, I set a breakpoint and start debug. Within a few seconds, the following pop-up window:

启动 unicodeRead 遇到问题.无法连接到虚拟机.

转储到控制台的消息如下:

The message dumped on the console is as follows:

ERROR: transport error 202: connect failed: Connection refused
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:708]
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)  

我该如何纠正?为什么会发生这种情况?

How do I correct this? Why does this happen?

推荐答案

我刚刚遇到了同样的问题.

I just had the same problem.

昨天一切正常,现在什么都没有 - 与您给出的错误相同.我发现网络管理员在此期间进行了一些更改.一些防火墙的东西.问题是 Eclipse 试图在本地主机"(和一些随机端口)建立到 JVM 的连接.当我尝试 ping 本地主机(或 127.0.0.1)时,我得到以下信息:

Yesterday everything worked fine, now nothing - same error as you gave. I found out that network admins made some changes in the meantime. Some firewall stuff. Problem is that Eclipse tries to establish connection to JVM at "localhost" (and some random port). When I tried pinging localhost (or 127.0.0.1) I got following:

C:Windowssystem32>ping 127.0.0.1
Pinging 127.0.0.1 with 32 bytes of data:
PING: transmit failed. General failure.
PING: transmit failed. General failure.
PING: transmit failed. General failure.
PING: transmit failed. General failure.

C:Windowssystem32>ping localhost
Ping request could not find host localhost. Please check the name and try again.

在某些情况下,预计 DNS 会解决这个问题,如果防火墙阻止本地主机请求 DNS - 事情就会中断.我不得不更改主机文件并删除以下行中的注释,因此我不再依赖 DNS:

It seams that in some cases DNS is expected to resolve this, and if firewall prevents localhost requests to DNS - stuff breaks. I had to alter hosts file and remove comments in following lines, so I would not rely on DNS for this anymore:

# 127.0.0.1       localhost
# ::1             localhost

虽然写的hosts文件更改会立即生效,但我认为某些进程锁定了这个并在我的情况下重新启动是必要的.之后,一切又恢复了.

Although it is written that hosts file changes take effect immediately, I think that some processes locked this and restart was necessary in my case. After that, everything worked again.

这篇关于无法使用 Eclipse 在 Java 中进行调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆