当我尝试通过 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/