eclipse 远程调试时Eclipse连接被拒绝
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30129746/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Eclipse connection refused when remote debugging
提问by ConfusedDeer
I've been following this tutorial which is how to setup remote debugging. I have my Jar running debug mode listening on port 6065 on my server with the following setting:
我一直在关注这个教程,它是如何设置远程调试的。我的 Jar 运行调试模式,监听服务器上的端口 6065,设置如下:
-Xrunjdwp\:transport\=dt_socket,server\=y,address\=6065,suspend\=n
I start the JAR on my server with jar in debug mode with:
我在调试模式下使用 jar 在我的服务器上启动 JAR:
myApplicationThatContainsJar.exe -debug "my application"
> Now Starting JVM
> Listening for transport dt_socket at address: 6065
I have psping tool installed which I use to ping (IPaddress:port). I am able to ping my ipaddress example: 44.66.33.66:6065 from my dev box and get a reply. But when I try to initiate remote debug in Eclipse I get:
我安装了 psping 工具,用于 ping(IP 地址:端口)。我可以从我的开发箱 ping 我的 ipaddress 示例:44.66.33.66:6065 并得到回复。但是当我尝试在 Eclipse 中启动远程调试时,我得到:
Failed to connect to remote VM. Connection refused. Connection refused: connect
无法连接到远程 VM。拒绝连接。连接被拒绝:连接
I have verified I've added permission for both inbound and outbound traffic for that port on both my DEV box and server.
我已经验证我已经在我的 DEV 盒和服务器上为该端口的入站和出站流量添加了权限。
When I start my JAR on my server and before I try to connect with Eclipse I do a:
当我在服务器上启动 JAR 时,在尝试连接 Eclipse 之前,我会执行以下操作:
psping 44.66.33.66:6065
And I get a response stating that it sent and recieved with 0% loss, meaning I am indeed getting a response.
我收到一条回复,说明它发送和接收的损失为 0%,这意味着我确实收到了回复。
In the eclipse debug configuration, which in the 'Debug Configurations' window I have the host and port listed properly and the 'Connection Type: Standard(Socket Attach)'.
在 Eclipse 调试配置中,在“调试配置”窗口中,我正确列出了主机和端口以及“连接类型:标准(套接字连接)”。
As soon as I try to connect with Eclipse and get the connection refused error I try psping again from the command line, but now eclipse did something to the connection and I get in the command line:
一旦我尝试与 Eclipse 连接并收到连接被拒绝的错误,我就会再次尝试从命令行 psping,但现在 eclipse 对连接做了一些事情,我进入了命令行:
The remote computer refused the network connection.
远程计算机拒绝网络连接。
Any suggestions where else I should check? or where else I should troubleshoot? I'm trying to do remote-debugging for my JAR from the DEV box to my server.
有什么建议我还应该检查哪里?或者我应该在哪里排除故障?我正在尝试从 DEV 盒到我的服务器对我的 JAR 进行远程调试。
采纳答案by ConfusedDeer
-Xrunjdwp\:transport\=dt_socket,server\=y,address\=6065,suspend\=n
should be:
应该:
-Xrunjdwp\:transport\=dt_socket,server\=y,address\=6065,suspend\=y
notice the suspend\=y
keep in mind I need to escape the equals and others may not need to do this. Once I set to suspend\=y
the application waited for me to connect from eclipse and I was able to begin remote debugging.
注意suspend\=y
请记住,我需要逃避平等,而其他人可能不需要这样做。一旦我设置为suspend\=y
应用程序等待我从 eclipse 连接,我就能够开始远程调试。
Don't forget to open inbound and outbound traffic for the port you used for address\=6065
不要忘记为您使用的端口打开入站和出站流量 address\=6065
回答by Tabish Ali
Check network setting in VM and set Attached to: Bridged Adapter
Check VM IP using ipconfig command
Run Java Application using following command
> java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=n myapp
Above command myapp replace to your application name
In eclipse go to debug configuration -> remote java Application -> New
Host: remote VM ip
Port: given port that given in command
Apply -> Debug