JMX connection fails with "handshake failed...expected JDWP-Handshake"
22,497
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.
Author by
crockpotveggies
Updated on July 11, 2022Comments
-
crockpotveggies almost 2 years
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.
-
crockpotveggies over 7 yearsokay solves most of the problem, except I enabled JMX on startup and set that as the port...so what am I missing here?
-
Nicholas over 7 yearsWell... I am fairly sure the debug port is bound first, so the JMX listener is probably failing silently, but it's not hard to say without seeing your config. Or... Perhaps JMX and jdwp are binding to the same port on different interfaces ?
-
crockpotveggies over 7 yearsJust updated my command line config, changed the JMX port to 5006, still no dice, I can connect VisualVM to the jstatd instance though
-
crockpotveggies over 7 yearsThis solved the problem, it was Gradle: gist.github.com/zedar/82f10d1064b00cbea79d