Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JMX : cant connect from Windows box to monitor JMX port on a Linux system

I have a lot of experience with jconsole.exe and JVisualVM.exe , in the JDK1.6 and have connected thousands of times from a Windows JVM over to a Windows JVM on another machine via JMX.remote but it fails when I try to monitor a java instance that is running on a Linux host (from a Windows host and I tried JMX listener on redhat and SUSE at Amazon EC2). I also tried using jconsole.exe and get a similar error.

Is there any reason anyone can think of , why this kind of JMX connection would have a problem. Any ideas I can try? Has anyone "actually" done this and can say it will work if I persevere?

The error I get from JVisualVM (on the remote connect attempt) is something like this:

"Cannot connect using service:jmx:rmi:///jndi/rmi://<jmx service ip>:8001/jmxrmi"

My remote JMX service config is like this:

 -Dcom.sun.management.jmxremote
 -Dcom.sun.management.jmxremote.port=8001
 -Dcom.sun.management.jmxremote.authenticate=false
 -Dcom.sun.management.jmxremote.hostname=<jmx service ip>

Found a similar question at this link but it didn't answer my question.

I verified that "iptables" is not enabled as a service and is not on and so I don't imaging there is any sort of firewall blockage. Also, both the windows and linux machine are on a 10.0.0.0 private internal subnet together. I am able to telnet into the port 8001 to verify its there , and its listening (netstat -ap) on the linux machine.

like image 824
djangofan Avatar asked Jan 20 '23 04:01

djangofan


1 Answers

See the system property java.rmi.server.hostname. On your Linux server JVM, set this system property to be the public IP of the host. Then use the public IP in you client JMX URL.

like image 191
Nicholas Avatar answered Jan 31 '23 06:01

Nicholas