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

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

时间: 2024-10-08 20:21:52

service:jmx:rmi:///jndi/rmi的相关文章

扩展 Spring 的 JMX 支持(2)

扩展 Spring JMX 导出器 为了使用扩展的 ModelMBean,需要覆盖 Spring MBeanExporter 中的 createModelMBean() 方法.因为可以注入装配器属性,所以必须知道它可能不是我所期待的这一事实.可以在构造函数中设置所需要的装配器,但是当装配器改变时需要返回一个普通 ModelMBean.所要做的就是缓存一个 MBeanInfoAssembler 的本地引用,并在创建新的 ModelMBean 时检查它是什么类型的.清单 2 显示了所有这些改变:清单

从零开始玩转JMX(一)——简介和Standard MBean

JMX的全称为Java Management Extensions. 顾名思义,是管理Java的一种扩展.这种机制可以方便的管理.监控正在运行中的Java程序.常用于管理线程,内存,日志Level,服务重启,系统环境等. 简介 基本术语 MBean:是Managed Bean的简称,可以翻译为"管理构件".在JMX中MBean代表一个被管理的资源实例,通过MBean中暴露的方法和属性,外界可以获取被管理的资源的状态和操纵MBean的行为.事实上,MBean就是一个Java Object

2007.02.03我在BEA成都UG第三次活动上面的Spring JMX源码与PPT资料

http://yulimin.javaeye.com/blog/52354 关键字: Spring   Spring JMX Log4J Logging AJAX SVG     利用Spring来管理控制自己的应用程序 PPT 文件下载:yulimin.javaeye.com/topics/download/be60fb70-e017-41fd-88a7-130d6293dba2 代码文件下载:yulimin.javaeye.com/topics/download/8be6bc63-fb74-

JMX操作实例--做一回技术控

我来做一回技术控,这部分内容也是简单的API调用例子而已,做一回技术控,发点小骚文,不过你看了,也许知道JConsole是怎么做出来的了,呵呵! 先不用管他干什么,代码运行后,自己改改自然知道做什么的. 例子全部应该都可以运行,使用者,拷贝回去就基本可以用了,无需其他内容的支持,有部分代码对JDK的版本有要求,例如在使用:ThreadMXBean.getThreadAllocatedBytes(id),这个是在JDK 6 update 25中开始支持的,而且在JDK 1.6中获取出来还有问题不少

jmx-【防火墙已关闭】帮看下JMX本地Main方法连接取Broker报错

问题描述 [防火墙已关闭]帮看下JMX本地Main方法连接取Broker报错 **帮我看下JMX本地Main方法连接取Broker报错 (No broker is found at any of the 1 configured urls)** JConsole通过jmxrmi连接 service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi本地正常 activemq.xml配置 <!-- Licensed to the Apache Software

使用JMX监控Kafka

http://blog.csdn.net/eric_sunah/article/details/44980385?utm_source=tuicool   使用JMX监控Kafka 标签: KafkaJMX监控 2015-04-10 15:43 2952人阅读 评论(3) 收藏 举报  分类: Kafka(8)  版权声明:本文为博主原创文章,未经博主允许不得转载. 目录(?)[+] Kafka可以配置使用JMX进行运行状态的监控,既可以通过JDK自带Jconsole来观察结果,也可以通过Jav

JMX远程注册MBean报错The MBean class could not be loaded by the default loader reposit

问题描述 在远程机器上运行一个MBeanServer(如192.168.1.100),spring配置:<!--导出springbean所有的方法和属性不使用赖加载--><beanid="exporter"class="org.springframework.jmx.export.MBeanExporter"lazy-init="false"><!--需要导出为MBean的spring类--><prope

如何使用JMX监控Kafka

使用kafka做消息队列中间件时,为了实时监控其性能时,免不了要使用jmx调取kafka broker的内部数据,不管是自己重新做一个kafka集群的监控系统,还是使用一些开源的产品,比如yahoo的kafka manager, 其都需要使用jmx来监控一些敏感的数据.在kafka官网中 http://kafka.apache.org/082/documentation.html#monitoring 这样说: Kafka uses Yammer Metrics for metrics repo

5招教你把握Java性能监控(转自51testing)

很多开发者觉得自己懂Java编程,事实是大多数开发人员都只领会到了Java平台的皮毛,所学也只够应付工作.作者将深度挖掘Java平台的核心功能,揭示一些鲜为人知的事实,帮助您解决最棘手的编程困难. 当应用程序性能受到损害时,大多数开发人员都惊慌失措,这在情理之中.跟踪Java应用程序瓶颈来源一直以来都是很麻烦的,因为Java虚拟机有黑盒效应,而且Java平台分析工具一贯就有缺陷. 然而,随着Java5中JConsole的引入,一切都发生了改变.JConsole是一个内置Java性能分析器,可以从