Explain JMX URL

I am trying to understand the JMX service url.

service:jmx:rmi://192.168.30.10:1234/jndi/rmi://192.168.30.10:2344/jmxrmi 

It would be great if someone can help me figure this out.

thank

+57
java jmx
May 04 '10 at 18:48
source share
3 answers

I am reusing the answer that I wrote earlier for this question: Can't connect to MBeanServer from Tomcat via jconsole in Java6

It is not complete, but may help:

Suppose you have a JMX server (alias "JMX Agent" alias "JVM that you want to connect to") running on "TARGET MACHINE" with the RMI registry port in "RMI REGISTRY PORT" and the JMX RMI server port in " JMX RMI SERVER PORT ".

Note:

  • The RMI registry tells JMX clients where to find the JMX RMI server port; information can be obtained under the jmxrmi key.
  • The RMI registry port is commonly known to be set through system properties when starting the JVM.
  • The JMX RMI server port is usually not known as the JVM at random (unless other precautions are taken).

The following URI will result in a successful connection (verified)

service:jmx:rmi://<TARGET_MACHINE>:<JMX_RMI_SERVER_PORT>/jndi/rmi://<TARGET_MACHINE>:<RMI_REGISTRY_PORT>/jmxrmi

It looks nasty. Cut it.

This URI is the URL of RFC2609 "Service Protocol URL" (well, this is really a URI, isn't it?)

It consists of:

  • service - constant
  • jmx:rmi - service type consisting of: abstract jmx type and rmi URL rmi
  • the rest is sap (service access protocol specification)

sap decomposes into:

  • //<TARGET_MACHINE>:<JMX_RMI_SERVER_PORT> - ipsite
  • /jndi/rmi://<TARGET_MACHINE>:<RMI_REGISTRY_PORT>/jmxrmi - part of the URL

A well-informed JMX client connects to ipsite to exchange JMX-over-RMI; but what of the JMX client that does not know this port? Patience ...

The URL is broken into:

  • /jndi/ - This seems to tell the JMX client that he can get search information at the location that follows
  • rmi://<TARGET_MACHINE>:<RMI_REGISTRY_PORT>/jmxrmi - Yes, we get information about the JMX RMI server in the RMI registry under the search key jmxrmi

This is a bit of a horse-drawn carriage, since you must first contact the RMI registry, which is part of the last SLP URL.

After scratching your head, intuitively, try:

service:jmx:rmi://<TARGET_MACHINE>/jndi/rmi://<TARGET_MACHINE>:<RMI_REGISTRY_PORT>/jmxrmi

Yes it works! The JMX RMI server port is well received from the registry. Secondly, the target machine must also be obtained from the registry, thus:

service:jmx:rmi:///jndi/rmi://<TARGET_MACHINE>:<RMI_REGISTRY_PORT>/jmxrmi

Even better, it works too!

Literature:

+86
Aug 17 '11 at 20:15
source share

Explain:

 service:jmx:rmi://192.168.30.10:1234/jndi/rmi://192.168.30.10:2344/jmxrmi 
  • service:jmx:rmi://192.168.30.10:1234 - says that there is a JMX agent on the machine with the IP address 192.168.30.10. The JMX agent uses (TCP) port 1234 to provide JMX services through RMI (basically works as an RMI server).
  • /jndi/rmi://192.168.30.10:2344/jmxrmi - says that the RMI stub for interacting with the JMX agent through RMI can be found in the RMI registry, which runs on a computer with IP address 192.168.30.10 and uses (TCP) port 2344. To get the RMI stub you need to find the binding "jmxrmi".

The previous answers suggest that the second part of the URL should get the server port of the JMX RMI server. This is not true. The JMX RMI server port is (TCP) 1234 and is part of the URL. What you get from the RMI registry is the RMI stub ( javax.management.remote.rmi.RMIServerImpl_Stub ), which you can use to communicate with the JMX agent (MBean Server) over RMI.

Hope this helps.

+5
Aug 18 '16 at 9:38 on
source share

According to javax.management.remote.rmi

this url is assembled this way

 service:jmx:rmi://ignoredhost/jndi/rmi://myhost/myname 
+2
May 04 '10 at 19:29
source share



All Articles