Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Application prints "Listening for transport dt_socket at address: 5005" and does not halt

I start code execution with the typical arguments:

java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 myPackage.myMainClassname

Application starts, prints "Listening for transport dt_socket at address: 5005" and... goes further! Without any attempt to wait for connection. I CAN connect to it during execution and debugging itself works. But why does the application not wait for connection from debugger?

Looks like something is broken in my configuration, but I cannot figure out the root cause. I tried several ways to specify debug settings, different ports, run as administrator, turn off firewalls - nothing helps.

like image 828
MiamiBeach Avatar asked Jul 17 '16 21:07

MiamiBeach


2 Answers

You need to specify suspend=y if you want it to wait for connection. Your debugging is working. If you try to connect you will be able to. Most probably you are just used to using suspend=y which blocks until the connection is established.

The behavior is expected when suspend=n.

like image 119
Alexander Petrov Avatar answered Oct 14 '22 13:10

Alexander Petrov


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.

Now your web-application is running under the debugger: you can set breakpoints, watch/inspect variables etc.etc.

like image 31
Igor Bykov Avatar answered Oct 14 '22 14:10

Igor Bykov