I'm trying to remote debug an Eclipse (OSGi) Application using the Intellij IDEA's Remote run configuration. Unfortunately, every time I run the application in Eclipse, the app never waits for a remote connection and I'm unable to attach a remote debugger to it.
I configured the Eclipse run configuration by adding the following argument to Run > Run Configurations... > Eclipse Application > Arguments: -agentlib:jdwp=transport=dt_socket,address=5005,server=y,suspend=y
.
When I run the configuration in Eclipse the application starts immediately instead of the JVM waiting for the remote connection, even though I defined the suspend=y
parameter. If I try to run the Intellij remote configuration, it gives the following message: Unable to open debugger port (localhost:6000): java.net.ConnectException "Connection refused: connect"
.
I also tried to make the Eclipse app attach (instead of listening) to the Intellij IDEAs remote debugger, but it also didn't work (the app didn't try to connect to the remote debugger).
The following images show the run configurations:
Other information:
As @howlger pointed out in his comment, the correct place for that argument is in the "VM arguments" (not the "Program arguments"). After that change, the application now correctly waits for the debugger to attach.