service:jmx:rmi:///jndi/rmi

简介: service:jmx:rmi:///jndi/rmi://ip:9889/jmxrmi  http://stackoverflow.com/questions/2768087/explain-jmx-url According to javax.

service:jmx:rmi:///jndi/rmi://ip:9889/jmxrmi

 http://stackoverflow.com/questions/2768087/explain-jmx-url

According to javax.management.remote.rmi

this url is assembled like this

service:jmx:rmi://ignoredhost/jndi/rmi://myhost/myname
67down voteaccepted

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 REGISTRY PORT' and the JMX RMI server port at 'JMX RMI SERVER PORT'.

Note:

  1. The RMI registry tells JMX clients where to find the JMX RMI server port; information can be obtained under key jmxrmi.
  2. The RMI registry port is generally known as it is set through system properties at JVM startup.
  3. The JMX RMI server port is generally not known as the JVM chooses it at random (if no other precautions are taken).

The following URI will lead to successful connection (tested)

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

This looks nasty. Let's cut it apart.

This URI is an RFC2609 "Service Location Protocol URL" (well, it's really an URI, right?)

It is composed of:

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

sap is decomposed into:

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

A well-informed JMX client connects to the "ipsite" to do JMX-over-RMI exchanges; but what of the JMX client that doesn't KNOW that port? Patience...

URL part is decomposed into:

  • /jndi/ - This seems to tell the JMX client that it can get lookup information at the location that follows
  • rmi://<TARGET_MACHINE>:<RMI_REGISTRY_PORT>/jmxrmi - Yep, we get information about the JMX RMI Server at the RMI registry, under the lookup key jmxrmi

This is somewhat cart-before-horse, as one has to contact the RMI registry given by the latter part of the SLP URL first.

After scratching head, intuitively, let's try:

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

Yes, that works! The JMX RMI server port is nicely obtained from the registry. On second thoughts, the target machine should also be obtained from the registry, thus:

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

Even better, that works, too!

References:

  1. http://download.oracle.com/javase/6/docs/api/javax/management/remote/rmi/package-summary.html
  2. http://download.oracle.com/javase/6/docs/api/javax/management/remote/JMXServiceURL.html
  3. http://mx4j.sourceforge.net/docs/ch03s04.html
  4. http://download.oracle.com/javase/6/docs/technotes/guides/management/agent.html#gdevg
  5. http://www.rfc-editor.org/rfc/rfc2609.txt
相关文章
|
3月前
|
负载均衡 应用服务中间件 Docker
Docker Service 创建
Docker Service 创建
|
4月前
|
Java 应用服务中间件 Spring
WebService - CXF 与Spring整合(Service+Client)
WebService - CXF 与Spring整合(Service+Client)
24 0
|
应用服务中间件
unable to open the service “tomcat8“ (无法打开服务“tomcat8”)
unable to open the service “tomcat8“ (无法打开服务“tomcat8”)
122 0
unable to open the service “tomcat8“ (无法打开服务“tomcat8”)
|
Kubernetes 负载均衡 监控
关于K8s中Headless Service的一些笔记
分享一些 K8s 中 Headless Service 的笔记 博文内容涉及: Headless Service 的简单介绍 Headless Service 创建 集群内/外 获取 Headless Service对应 Pod 列表的 Demo 理解不足小伙伴帮忙指正
344 0
|
网络协议 应用服务中间件 Docker
Docker - 解决 Error response from daemon: driver failed programming external connectivity on endpoint tomcat9999
Docker - 解决 Error response from daemon: driver failed programming external connectivity on endpoint tomcat9999
2820 0
|
关系型数据库 MySQL 数据安全/隐私保护
navicat 连接Docker中mysql容器报错:Client does not support authentication protocol requested by server;
navicat 连接Docker中mysql容器报错:Client does not support authentication protocol requested by server;
277 0
navicat 连接Docker中mysql容器报错:Client does not support authentication protocol requested by server;
|
XML 存储 安全
wildfly 21的domain配置
wildfly 21的domain配置
wildfly 21的domain配置
|
Java Windows 网络协议
|
应用服务中间件 Android开发
|
Java 应用服务中间件