I have a java proccess which runs like
tomcat 3400481 2.1 19.3 6323248 1579708 ? Sl Feb08 32:20 /usr/lib/jvm/java-11-openjdk-amd64/bin/java -Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 -Xms1024M -Xmx2048M -server -XX:+UseParallelGC -javaagent:/opt/opentelemetry-javaagent.jar -javaagent:/opt/tomcat/jmx_prometheus_javaagent-0.19.0.jar=9092:/opt/tomcat/tomcat.yml -Dignore.endorsed.dirs= -classpath /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar -Dcatalina.base=/opt/tomcat -Dcatalina.home=/opt/tomcat -Djava.io.tmpdir=/opt/tomcat/temp -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n org.apache.catalina.startup.Bootstrap start
with port forwarding to this machine I easily attach to this process with JVM Debugger of my Intellij Idea, in catalina.out
I see the only log entry like that:
Listening for transport dt_socket at address: 8000
and nothing is prompted, I just see the debug started and it works
When I attach to the same with jconsole
,I see in the log:
Debugger failed to attach: handshake failed - received >< - expected >JDWP-Handshake<
Debugger failed to attach: recv failed during handshake: Resource temporarily unavailable
and JConsole refuse to connect:
error during jrmp connection establishment nested exception is java.io.eofexception
What could be the reason for this different behavior? Jconsole
is of the same version of java (JDK 9) that runs the remote debug.
And for now I have no details and don't know, what sort of details to retrieve to solve the problem. If some sort of smart asses know, which sort of the details is needed, they are welcomed to the comments to ask what sort of details are needed to clarify the question. On my side is clear that the Intellij Idea debugger uses the same protocol like JConsole.
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=1616 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=10.122.97.13
was added to fix the issue.
It is very important to understand, that -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n
that is needed for debug isn't the same as jmx remote that is needed for jconsole.