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:
我正在尝试使用Eclipse作为IDE在我的机器上调试一个简单的Java应用程序。当我尝试通过输入debug透视图来调试应用程序时,我设置了一个断点并开始调试。在几秒钟内,以下弹出窗口:
Launching unicodeRead has encountered a problem. Cannot connect to VM
.
推出独头鲸遇到了一个问题。不能连接到虚拟机。
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?
我怎么改正这个?这为什么会发生?
9 个解决方案
#1
21
I just had the same problem.
我也有同样的问题。
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:
昨天一切都很好,现在没有了——和你犯的错误一样。我发现网络管理员在此期间做了一些改变。一些防火墙的东西。问题是,Eclipse试图在“localhost”(以及一些随机端口)上建立与JVM的连接。当我尝试pinglocalhost(或127.0.0.1)时,我得到以下信息:
C:\Windows\system32>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.
and
和
C:\Windows\system32>ping localhost
Ping request could not find host localhost. Please check the name and try again.
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:
在某些情况下,DNS有望解决这个问题,如果防火墙阻止了本地主机对DNS的请求。我不得不在以下几行中修改主机文件并删除注释,所以我不会再依赖DNS了:
# 127.0.0.1 localhost
# ::1 localhost
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.
尽管主机文件更改会立即生效,但我认为某些进程对此进行锁定并重新启动是必要的。在那之后,一切又恢复了正常。
#2
4
Looks like the same problem as here. A reboot of the pc fixed the problem there. I haven't found any other solutions.
看起来和这里一样。重启电脑解决了这个问题。我还没有找到其他的解。
#3
2
Its Very Simple,Just do the Following Changes in eclipse.ini file.
它非常简单,只需在eclipse中执行以下更改。ini文件。
-vm
binary\com.sun.java.jdk.win32.x86_1.6.0.u43\jre\bin\javaw.exe
#4
0
My case is I have a bunch of domains refer to 127.0.0.1 in hosts file, like this:
我的情况是,我在主机文件中有一些域引用127.0.0.1,如下所示:
127.0.0.1 localhost domian1.local domain2.local domain3.local
127.0.0.1 localhost domian1。当地domain2。当地domain3.local
one day I added another new domain to refer to 127.0.0.1. By mistake, I put the domain in front of "localhost", like this:
有一天,我添加了另一个新域来引用127.0.0.1。错误地,我将域放在“localhost”前面,如下所示:
127.0.0.1 domain4.local localhost domian1.local domain2.local domainx.local
127.0.0.1 domain4。当地localhost domian1。当地domain2。当地domainx.local
After this, I always got an alert window in eclipse while debugging:
在此之后,我总是在调试时在eclipse中有一个警告窗口:
Cannot connect to VM com.sun.jdi.connect.TransportTimeoutException
无法连接到VM com.sun.jdi. connecttimeoutexception
In console:
在控制台:
ERROR: transport error 202: connect failed: Connection refused ERROR: JDWP: Failed to initialize transport via localhost:50470, trying localhost via 127.0.0.1:50470 FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197) 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:690]
错误:传输错误202:连接失败:连接拒绝错误:jdwinit:通过localhost:50470初始化传输失败,通过本地方法尝试localhost的127.0.1:50470致命错误:JDWP没有传输初始化,jtierror = agent_errort_transport_init (197)没有传输初始化(. . / . . / . . / src /分享/后面/ debugInit.c:690]
The solution is keep "localhost" at the first position all the time.
解决方案是始终将“localhost”保持在第一个位置。
127.0.0.1 localhost domian1.local domain2.local domainx.local domain4.local
127.0.0.1 localhost domian1。当地domain2。当地domainx。当地domain4.local
#5
0
What solved for me was deleting the entire domain1 folder inside the domains folder on glassfish main folder. Eclipse will ask you to recreate a domain and then everything works again.
我解决的是删除glassfish主文件夹域文件夹内的整个domain1文件夹。Eclipse将要求您重新创建一个域,然后再重新开始工作。
#6
0
I was seeing an error while using the -X format:
在使用-X格式时,我看到了一个错误:
java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=n myapp
The error went away when I switched to the newer format:
当我切换到新的格式时,错误消失了:
java -agentlib:jdwp=transport=dt_socket,server=y,address=4000,suspend=n myapp
#7
-1
I was getting the same error on my ubuntu machine because of a mishap with the /etc/hosts file. I had commented out the mapping of localhost to 127.0.0.1, and to complicate matters further there was a swap file hanging around.
我在我的ubuntu机器上犯了同样的错误,因为它的/etc/hosts文件有问题。我已经注释掉了localhost到127.0.0.1之间的映射,并且使问题更加复杂,有一个交换文件在附近徘徊。
This was the first line of my /etc/hosts:
这是我/etc/hosts的第一行:
127.0.0.1 #localhost
Deleting the # fixed the problem, whereas rebooting understandably had not.
删除#修复了问题,但是可以理解的是重新引导并没有修复问题。
#8
-1
My cause & solution were completely different.
I think in my case it was due to the installation of JProfiler. I fixed it by uninstalling JProfiler and launching eclipse with the -clean
option. I suspect that JProfiler was inserting itself in the debugger. The -clean
option forces Eclipse to re-assess its plugins, so that alone might have been sufficient.
我的原因和解决方法完全不同。我想这是由于JProfiler的安装。我通过卸载JProfiler并使用-clean选项启动eclipse来修复它。我怀疑JProfiler将自己插入到调试器中。clean选项迫使Eclipse重新评估其插件,因此单独使用可能已经足够了。
#9
-4
Continuing @gonadarian's answer, it seems Eclipse
uses port 127.0.0.1
for debug purposes. This port is also called localhost
. The way this error can be removed is by ensuring that there are no processes or services running on the above ports. The way to do this, on Linux is:
继续@gonadarian的回答,看起来Eclipse为了调试目的使用了端口127.0.0.1。这个端口也称为localhost。可以通过确保在上述端口上没有运行进程或服务来消除此错误。在Linux上做到这一点的方法是:
-
As
root
, enter the command:netstat -tulpn | grep 127.0.0.1
作为根,输入命令:netstat -tulpn | grep 127.0.0.1
-
If there are processes running on the above port, it will show up in the format:
process_id/process name
.如果有进程在上面的端口上运行,它将以以下格式显示:process_id/进程名。
-
Kill the above processes like so:
kill -KILL process_id
像这样杀死上面的进程:杀死-杀死process_id
-
Restart the computer for these changes to take effect. The error should no longer occur.
重新启动计算机,使这些更改生效。错误将不再发生。
#1
21
I just had the same problem.
我也有同样的问题。
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:
昨天一切都很好,现在没有了——和你犯的错误一样。我发现网络管理员在此期间做了一些改变。一些防火墙的东西。问题是,Eclipse试图在“localhost”(以及一些随机端口)上建立与JVM的连接。当我尝试pinglocalhost(或127.0.0.1)时,我得到以下信息:
C:\Windows\system32>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.
and
和
C:\Windows\system32>ping localhost
Ping request could not find host localhost. Please check the name and try again.
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:
在某些情况下,DNS有望解决这个问题,如果防火墙阻止了本地主机对DNS的请求。我不得不在以下几行中修改主机文件并删除注释,所以我不会再依赖DNS了:
# 127.0.0.1 localhost
# ::1 localhost
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.
尽管主机文件更改会立即生效,但我认为某些进程对此进行锁定并重新启动是必要的。在那之后,一切又恢复了正常。
#2
4
Looks like the same problem as here. A reboot of the pc fixed the problem there. I haven't found any other solutions.
看起来和这里一样。重启电脑解决了这个问题。我还没有找到其他的解。
#3
2
Its Very Simple,Just do the Following Changes in eclipse.ini file.
它非常简单,只需在eclipse中执行以下更改。ini文件。
-vm
binary\com.sun.java.jdk.win32.x86_1.6.0.u43\jre\bin\javaw.exe
#4
0
My case is I have a bunch of domains refer to 127.0.0.1 in hosts file, like this:
我的情况是,我在主机文件中有一些域引用127.0.0.1,如下所示:
127.0.0.1 localhost domian1.local domain2.local domain3.local
127.0.0.1 localhost domian1。当地domain2。当地domain3.local
one day I added another new domain to refer to 127.0.0.1. By mistake, I put the domain in front of "localhost", like this:
有一天,我添加了另一个新域来引用127.0.0.1。错误地,我将域放在“localhost”前面,如下所示:
127.0.0.1 domain4.local localhost domian1.local domain2.local domainx.local
127.0.0.1 domain4。当地localhost domian1。当地domain2。当地domainx.local
After this, I always got an alert window in eclipse while debugging:
在此之后,我总是在调试时在eclipse中有一个警告窗口:
Cannot connect to VM com.sun.jdi.connect.TransportTimeoutException
无法连接到VM com.sun.jdi. connecttimeoutexception
In console:
在控制台:
ERROR: transport error 202: connect failed: Connection refused ERROR: JDWP: Failed to initialize transport via localhost:50470, trying localhost via 127.0.0.1:50470 FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197) 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:690]
错误:传输错误202:连接失败:连接拒绝错误:jdwinit:通过localhost:50470初始化传输失败,通过本地方法尝试localhost的127.0.1:50470致命错误:JDWP没有传输初始化,jtierror = agent_errort_transport_init (197)没有传输初始化(. . / . . / . . / src /分享/后面/ debugInit.c:690]
The solution is keep "localhost" at the first position all the time.
解决方案是始终将“localhost”保持在第一个位置。
127.0.0.1 localhost domian1.local domain2.local domainx.local domain4.local
127.0.0.1 localhost domian1。当地domain2。当地domainx。当地domain4.local
#5
0
What solved for me was deleting the entire domain1 folder inside the domains folder on glassfish main folder. Eclipse will ask you to recreate a domain and then everything works again.
我解决的是删除glassfish主文件夹域文件夹内的整个domain1文件夹。Eclipse将要求您重新创建一个域,然后再重新开始工作。
#6
0
I was seeing an error while using the -X format:
在使用-X格式时,我看到了一个错误:
java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=n myapp
The error went away when I switched to the newer format:
当我切换到新的格式时,错误消失了:
java -agentlib:jdwp=transport=dt_socket,server=y,address=4000,suspend=n myapp
#7
-1
I was getting the same error on my ubuntu machine because of a mishap with the /etc/hosts file. I had commented out the mapping of localhost to 127.0.0.1, and to complicate matters further there was a swap file hanging around.
我在我的ubuntu机器上犯了同样的错误,因为它的/etc/hosts文件有问题。我已经注释掉了localhost到127.0.0.1之间的映射,并且使问题更加复杂,有一个交换文件在附近徘徊。
This was the first line of my /etc/hosts:
这是我/etc/hosts的第一行:
127.0.0.1 #localhost
Deleting the # fixed the problem, whereas rebooting understandably had not.
删除#修复了问题,但是可以理解的是重新引导并没有修复问题。
#8
-1
My cause & solution were completely different.
I think in my case it was due to the installation of JProfiler. I fixed it by uninstalling JProfiler and launching eclipse with the -clean
option. I suspect that JProfiler was inserting itself in the debugger. The -clean
option forces Eclipse to re-assess its plugins, so that alone might have been sufficient.
我的原因和解决方法完全不同。我想这是由于JProfiler的安装。我通过卸载JProfiler并使用-clean选项启动eclipse来修复它。我怀疑JProfiler将自己插入到调试器中。clean选项迫使Eclipse重新评估其插件,因此单独使用可能已经足够了。
#9
-4
Continuing @gonadarian's answer, it seems Eclipse
uses port 127.0.0.1
for debug purposes. This port is also called localhost
. The way this error can be removed is by ensuring that there are no processes or services running on the above ports. The way to do this, on Linux is:
继续@gonadarian的回答,看起来Eclipse为了调试目的使用了端口127.0.0.1。这个端口也称为localhost。可以通过确保在上述端口上没有运行进程或服务来消除此错误。在Linux上做到这一点的方法是:
-
As
root
, enter the command:netstat -tulpn | grep 127.0.0.1
作为根,输入命令:netstat -tulpn | grep 127.0.0.1
-
If there are processes running on the above port, it will show up in the format:
process_id/process name
.如果有进程在上面的端口上运行,它将以以下格式显示:process_id/进程名。
-
Kill the above processes like so:
kill -KILL process_id
像这样杀死上面的进程:杀死-杀死process_id
-
Restart the computer for these changes to take effect. The error should no longer occur.
重新启动计算机,使这些更改生效。错误将不再发生。