JMX connection fails with "handshake failed...expected JDWP-Handshake"

crockpotveggies picture crockpotveggies · Dec 22, 2016 · Viewed 18.4k times · Source

I'm trying to connect VisualVM to a remote JMX. IntelliJ can connect without hassle, but VisualVM fails with the following in log output:

Listening for transport dt_socket at address: 5005
Debugger failed to attach: recv failed during handshake: Resource temporarily unavailable
Debugger failed to attach: handshake failed - received >< - expected >JDWP-Handshake<

Here are the JVM properties I'm passing at runtime:

-XX:MaxPermSize=50g -XX:+HeapDumpOnOutOfMemoryError -Xmx50g -Dcom.sun.management.jmxremote -Djava.rmi.server.hostname=100.100.100.100 -Dcom.sun.management.jmxremote.port=5006 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false

Using VisualVM 1.3.9. Not sure why it fails why IntelliJ succeeds. I've tried disabling SSL auth, etc.

Answer

Nicholas picture Nicholas · Dec 22, 2016

The socket listening on 5005 is not a JMX listener, it's the java debug wire protocol listener. As such, VisualVM will not be able to connect to that port, and that's why you're seeing a handshake failure.