【问题标题】:Eclipse connection refused when remote debugging远程调试时Eclipse连接被拒绝
【发布时间】:2015-07-19 17:15:12
【问题描述】:

我一直在关注how to setup remote debugging 这个教程。 我的 Jar 使用以下设置在服务器上的端口 6065 上运行调试模式:

-Xrunjdwp\:transport\=dt_socket,server\=y,address\=6065,suspend\=n

我在我的服务器上使用 jar 在调试模式下启动 JAR:

myApplicationThatContainsJar.exe -debug "my application"

>     Now Starting JVM
>     Listening for transport dt_socket at address: 6065

我安装了 psping 工具,用于 ping(IP 地址:端口)。我可以从我的开发箱 ping 我的 ipaddress 示例:44.66.33.66:6065 并得到回复。但是当我尝试在 Eclipse 中启动远程调试时,我得到:

无法连接到远程虚拟机。拒绝连接。联系 拒绝:连接

我已验证我已在我的 DEV 盒和服务器上为该端口添加了入站和出站流量的权限。

当我在我的服务器上启动我的 JAR 并且在我尝试与 Eclipse 连接之前,我会执行以下操作:

psping 44.66.33.66:6065 

我收到回复说它发送和接收的损失为 0%,这意味着我确实收到了回复。

在 Eclipse 调试配置中,在“调试配置”窗口中,我正确列出了主机和端口以及“连接类型:标准(套接字连接)”。

当我尝试与 Eclipse 连接并收到连接被拒绝错误时,我再次尝试从命令行 psping,但现在 eclipse 对连接做了一些事情,我进入了命令行:

远程计算机拒绝网络连接。

还有什么我应该检查的建议吗?或者我还应该在哪里进行故障排除?我正在尝试对我的 JAR 从 DEV 框到我的服务器进行远程调试。

【问题讨论】:

    标签: java eclipse jar remote-debugging


    【解决方案1】:
    -Xrunjdwp\:transport\=dt_socket,server\=y,address\=6065,suspend\=n
    

    应该是:

    -Xrunjdwp\:transport\=dt_socket,server\=y,address\=6065,suspend\=y
    

    注意suspend\=y 请记住我需要转义等号,其他人可能不需要这样做。一旦我设置为suspend\=y,应用程序就会等待我从 eclipse 连接,然后我就可以开始远程调试了。

    不要忘记为您用于address\=6065 的端口打开入站和出站流量

    【讨论】:

      【解决方案2】:
      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
      

      【讨论】:

        猜你喜欢
        • 2020-07-07
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-10-29
        • 2013-08-02
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多