Cheking JMX Port Alive

java core 2009. 11. 19. 15:03

Cmdline-jmxclient.jar is very useful to check if jmx port of application alive.
You can download from jmxclient. and can use it below examples.
http://crawler.archive.org/cmdline-jmxclient/

When you use this command in shell, if you do not see any kinds of exception, it means successful. But, if you see a exception, it means a problem of application.

Ex1) Application have no jmx port
java -jar cmdline-jmxclient.jar - idowww.svr.google.com:11005 java.lang:type=Memory gc
Exception in thread "main" java.io.IOException: Failed to retrieve RMIServer stub: 
javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: idombr702.svr.hangame.com; nested exception is:
        java.net.ConnectException: Connection refused]
        at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:323)
        at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:248)
        at org.archive.jmx.Client.execute(Client.java:225)
        at org.archive.jmx.Client.main(Client.java:154)


 Ex2) Application have trouble of binding jmx port
java -jar cmdline-jmxclient.jar - idowww.svr.google.com:11005 java.lang:type=Memory gc

Exception in thread "main" java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.NameNotFoundException: jmxrmi
        at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:323)
        at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:248)
        at org.archive.jmx.Client.execute(Client.java:225)
        at org.archive.jmx.Client.main(Client.java:154)
Caused by: javax.naming.NameNotFoundException: jmxrmi
        at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:99)
        at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:185)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1871)
        at javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1841)
        at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:257)
        ... 3 more

 Ex2) Success - no print out.
Shell>java -jar cmdline-jmxclient.jar - idombr701.svr.hangame.com:11005 java.lang:type=Memory gc
Shell>
Posted by '김용환'
,