How to access JMX interface in docker from outside?

For completeness, the following solution worked. The JVM should be run with specific parameters established to enable remote docker JMX monitoring were as followed: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=<PORT> -Dcom.sun.management.jmxremote.rmi.port=<PORT> -Djava.rmi.server.hostname=<IP> where: <IP> is the IP address of the host that where you executed ‘docker run’ <PORT> is the port that must be published from docker … Read more

Difference between MBean and MXBean

MXBeans are just a special kind of MBeans. The main difference is that MXBean restrict the data types, so that they are “more compatible” with potential clients. As example: a MBean can expose attributes of a data type Foo. Now the client also needs to have this type Foo to make sense of the attribute. … Read more

Why Java opens 3 ports when JMX is configured?

Contrary to common belief JMX/RMI doesn’t need to open all these ports. You can actually force them to be same which will mean that at the end of the day you’ll only need to punch one hole in the firewall (if firewall is your concern). Try setting System Properties: com.sun.management.jmxremote.port com.sun.management.jmxremote.rmi.port to the same value!! … Read more

JConsole over ssh local port forwarding

There’s an even nicer way to do this using an SSH socks tunnel, since JConsole supports SOCKS: Create the SSH socks proxy locally on some free port (e.g. 7777): ssh -fN -D 7777 user@firewalled-host Run JConsole by specifying the SOCKS proxy (e.g. localhost:7777) and the address for the JMX server (e.g. localhost:2147) jconsole -J-DsocksProxyHost=localhost -J-DsocksProxyPort=7777 … Read more

Explain JMX URL

I will reuse an answer I wrote up earlier for this question: Cannot connect to Tomcat’s MBeanServer via jconsole in Java6 It’s not complete, but might help: Suppose you have the JMX Server (alias ‘JMX Agent’ alias ‘the JVM you want to connect to’) running on ‘TARGET MACHINE’ with the RMI registry port at ‘RMI … Read more

How do I attach VisualVM to a simple Java process running in a Docker container

At first you should run you application with these JVM params: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9010 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false Then you should expose port for docker: EXPOSE 9010 Also specify port binding with docker run command: docker run -p 9010:9010 -it –rm –name hwd hello-world-daemon After that you can connect with Jconsole to local 9010 port and manage … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)