java远程调试,eclipse无法保持连接

标签 java eclipse remote-debugging

当我尝试通过 eclipse 进行远程调试时遇到问题。

这些是我使用的参数:

-Xdebug
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=4044

我还尝试将地址设置为 0.0.0.0:4044,使用:

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

我已经尝试了各种设置,将挂起设置为“y”使应用程序等待调试连接,连接后应用程序继续运行但无法建立连接。

当我尝试从 eclipse 连接时,它只是超时。

如果我运行 netstat -tulpn | grep 4044 我得到这个输出:

tcp        0      0 0.0.0.0:4044                0.0.0.0:*                   LISTEN

有时在尝试连接后它会停止监听端口。

有什么想法吗?

最佳答案

通常在我使用的听力过程中:

-Xdebug -Xrunjdwp:transport=dt_socket,address=4044,server=y,suspend=n

你必须正确地开始这个过程
例如。对于 tomcat

    JPDA_OPTS="-agentlib:jdwp=transport=dt_socket,address=4000,server=y,suspend=n"
    catalina.sh jpda start

使用包装器作为狸猫:

http://wrapper.tanukisoftware.com/doc/english/prop-java-detect-debug-jvm.html

如果你读过它

The Wrapper has several features which are designed to detect when a JVM has frozen, or otherwise become unstable. Normally these features should all be left enabled. However, when a JVM is connected to a debugger, it is common for the JVM to intentionally be frozen as various debugging operations take place. In these cases, the Wrapper would normally think the JVM was frozen, and kill and restart it in the middle of a debug session. The Wrapper works around this problem by checking the configured Java command line and ignoring certain timeouts when it detects that a debugger is in use. This property makes it possible to enable or disable this debugging check. The default value is "TRUE", which will detect the debugging and ignore certain timeouts. Example: (detect the debugging) wrapper.java.detect_debug_jvm=TRUE

(...)

在你的情况下,我认为你只需要

    wrapper.java.detect_debug_jvm=FALSE

让我知道我是否正确,因为我无法对其进行测试。

关于java远程调试,eclipse无法保持连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18593591/

相关文章:

java - 什么是NullPointerException,我该如何解决?

java - 如何使用 Java 代码查看 JTextPane 中的段落符号?

java - 在 Eclipse 中安装【java 库】

java - 聊天机器人,最后一部分

iphone - iOS 的远程调试器?我需要调试一个配件

debugging - 无法在 Netbeans 中添加调试源

ios - 更新到 ios8.3 后丢失 safari 远程调试

java - 从枚举返回字符串文字

java - Java 代码中的 "misplaced construct(s)"靠近 catch

java - java eclipse 中关于包的图像的含义是什么?