应用程序打印 "Listening for transport dt_socket at address: 5005" 并且不会停止
Application prints "Listening for transport dt_socket at address: 5005" and does not halt
我使用典型参数开始执行代码:
java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 myPackage.myMainClassname
应用程序启动,打印 "Listening for transport dt_socket at address: 5005" 并且...更进一步!没有任何尝试等待连接。我可以在执行期间连接到它并且调试本身可以工作。但是为什么应用程序不等待来自调试器的连接?
看起来我的配置有问题,但我无法找出根本原因。我尝试了几种方法来指定调试设置、不同的端口、运行 作为管理员、关闭防火墙 - 没有任何帮助。
如果你想让它等待连接,你需要指定suspend=y
。您的调试工作正常。如果您尝试连接,您将能够连接。很可能您只是习惯于使用 suspend=y
,它会在连接建立之前阻塞。
suspend=n
时的预期行为。
Select menu "Run/Edit Configurations". Check: "Edit configurations"
dialog pops up. Click on "+" icon, select "Remote" from the list.
Check: new configuration with name "Unnamed" appears under "Remote"
category. Change configuration name to something more sensible, like
"Remote Debug". Don't change any other parameters, just click "OK".
Run web-application under the debugger
Start gradle task "appStartDebug" under IntelliJ IDEA. Attention: do
not try to start this task under the debugger. Run it in normal mode.
Check: you should see "Listening for transport dt_socket at address:
5005" in "Run" output window. Select menu "Run/Run...", select "Remote
Debug" configuration, select "Debug" command. Check: you should see
"Connected to the target VM, address: 'localhost:5005', transport:
'socket'" in "Debug" output window.
现在您的 Web 应用程序在调试器下 运行:您
可以设置断点,watch/inspect变量etc.etc.
我使用典型参数开始执行代码:
java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 myPackage.myMainClassname
应用程序启动,打印 "Listening for transport dt_socket at address: 5005" 并且...更进一步!没有任何尝试等待连接。我可以在执行期间连接到它并且调试本身可以工作。但是为什么应用程序不等待来自调试器的连接?
看起来我的配置有问题,但我无法找出根本原因。我尝试了几种方法来指定调试设置、不同的端口、运行 作为管理员、关闭防火墙 - 没有任何帮助。
如果你想让它等待连接,你需要指定suspend=y
。您的调试工作正常。如果您尝试连接,您将能够连接。很可能您只是习惯于使用 suspend=y
,它会在连接建立之前阻塞。
suspend=n
时的预期行为。
Select menu "Run/Edit Configurations". Check: "Edit configurations" dialog pops up. Click on "+" icon, select "Remote" from the list. Check: new configuration with name "Unnamed" appears under "Remote" category. Change configuration name to something more sensible, like "Remote Debug". Don't change any other parameters, just click "OK".
Run web-application under the debugger
Start gradle task "appStartDebug" under IntelliJ IDEA. Attention: do not try to start this task under the debugger. Run it in normal mode. Check: you should see "Listening for transport dt_socket at address: 5005" in "Run" output window. Select menu "Run/Run...", select "Remote Debug" configuration, select "Debug" command. Check: you should see "Connected to the target VM, address: 'localhost:5005', transport: 'socket'" in "Debug" output window.
现在您的 Web 应用程序在调试器下 运行:您 可以设置断点,watch/inspect变量etc.etc.