简体   繁体   中英

Monitoring Glassfish 4 on Docker with JVisualVM

I'm not able to connect JVisualVM to Glassfish running on Docker. I'm using the glassfish nightly image and I'm exposing port 8686. On Startup Glassfish is logging the following:

JMXStartupService has started JMXConnector on JMXService URL service:jmx:rmi://55bbdd404578:8686/jndi/rmi://55bbdd404578:8686/jmxrmi

The IP of my docker host is 192.168.99.100 and I can connect via telnet on port 8686.

The Service URL I'm using is service:jmx:rmi://192.168.99.100:8686/jndi/rmi://192.168.99.100:8686/jmxrmi and I'm passing the security credentials but can't connect. Am I missing something?

Struggled with the same issue.

Add following to server-config –> jvm-settings –> JVM option

-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port='your JMX port'
-Dcom.sun.management.jmxremote.local.only=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Djava.rmi.server.hostname='IP of you docker host'

and simply do the rest in the same way as before.

When U look at server.log U'll notice that JMX service is exposed as:

JMXStartupService has started JMXConnector on JMXService URL service:jmx:rmi://e15295161718:40086/jndi/rmi://e15295161718:40086/jmxrmi

and problably these configuration entries change e15295161718 to IP and JVisualVM can connect. From Ur host's perspective e15295161718 is rubbish to JVisualVM.

Port 8686 is not exposed by Docker file, therefore You need to use --publish 8686:8686 with docker run command to make that port exposed to the host computer. See docker help run for mire details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM