How to access JMX (Java Beans) from a process running in a docker container

Why is it so difficult to connect to the JMX port (using JConsole) when the process is running using Docker.

Of course, I was shown the JMX port for the host and even used special Sun settings while the Java process was running (according to the instructions http://ptmccarthy.imtqy.com/2014/07/24/remote-jmx-with-docker / ).

I can use telnet for the ip host and the open JMX port, which reports that it is available. But I cannot figure out how to use JConsole and connect to the JMX service running in the container.

-Djava.rmi.server.hostname=$JMX_HOSTNAME -Dcom.sun.management.jmxremote.port=$JMX_PORT -Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT 
+1
source share
3 answers

In the past, two ports should have been different. Try this one to get started.

If this does not work:

Tomcat offers an additional component for installing the second port mentioned: the JMX Remote Lifecycle Listener .

Please take a look at:

http://tomcat.apache.org/tomcat-7.0-doc/extras.html

http://tomcat.apache.org/download-70.cgi

I use this parameter with the katalin-jmx-remote.jar in my tomcat / lib directory to go through:

 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=localhost -DrmiRegistryPortPlatform=10381 -DrmiServerPortPlatform=10380 

Plus these, but you don't need them in a dev environment.

 -Dcom.sun.management.jmxremote.password.file=/home/tomcat/jmxremote.password -Dcom.sun.management.jmxremote.access.file=/home/tomcat/jmxremote.access -Dcom.sun.management.jmxremote.authenticate=true 
0
source

What you currently look correct. To at least try and make it work, I will try to disable auth and ssl. Then, as soon as you earn money, think about reactivating any security you need:

 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false 
0
source

Indeed, you need these two ports for different. One port is for the RMI registry, and the other is for the remote access protocol.

When specifying the URL to connect to the server from jconsole / visualvm, use the port set in "-Dcom.sun.management.jmxremote.port" on the server side.

-1
source

Source: https://habr.com/ru/post/1242662/


All Articles