Haseeb Javed Haseeb Javed - 1 year ago 211
Java Question

Debugging - IntelliJ can not connect to debug enabled JVM on a remote server

I have a typical in-house cluster with a login node and multiple compute nodes. For a start, I ran a JVM instance with the following params to let my IntelliJ debugger connect to it.


This login node has a pubically accessible address which I mostly ssh into to launch jobs. However, when I try to attach my IntelliJ debugger to a JVM instance on this node, the connection just times it and it is unable to connect while my JVM instance is indeed launched in the suspended mode waiting for the debugger to connect to it.

IntelliJ Remote debug configuration

The initial problem seemed to be that I get not access any other port on my server other than port 22 which I use to SSH into it. Anyhow, I was able to create a SOCK5 proxy, configured IntelliJ to use that proxy and then successfully test the connection as well as shown below:

Testing the connection at the host:port the debugger is listenning at

The output on the debugger console shows that IntelliJ was successfully able to access that port on the specified hostname, albiet with an HTTP request and not a JWP one.

Debugger console output

However, when I then proceed to connect the debugger to the same host:port combination, I am unable to do so and get the following error:

Debugger error

I have also tried setting
but to no avail.

Answer Source

ssh -L 5005:localhost:5005 [email protected]

will map localhost:5005 to port 5005 on myserver.com (also on localhost interface of myserver.com). This way in IntelliJ IDEA debugger you will be connecting to localhost (specify it in the Host field) port 5005 and the connection will be forwarded to the remote server where debugger listens on localhost:5005.

See here for more details how SSH tunnels work

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download