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-07-28 13:30:04

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

Kafka日志报错:[error] k.m.j.KafkaJMX$ - Failed to connect to service:jmx:rmi:///jndi/rmi://10.1.3.116:-1/jmxrmi java.lang.IllegalArgumentException: requirement failed: No jmx port but jmx polling enabled!

一.Kafka日志报错:[error] k.m.j.KafkaJMX$ - Failed to connect to service:jmx:rmi:///jndi/rmi://10.1.3.116:-1/jmxrmi java.lang.IllegalArgumentException: requirement failed: No jmx port but jmx polling enabled! 以上报错,并没有对Kafka对使用造成直接影响: 1>.启动生产者:kafka-console

错误: JMX 连接器服务器通信错误: service:jmx:rmi://***

电脑没有空间了,正想清理一下硬盘空间,这时不知道金山毒霸啥时候装上了,就想把它卸载了,卸载的过程中看到有空间清理,随手一点,清理出了10个G,然后再打开idea运行项目就报出这个错. 错误: JMX 连接器服务器通信错误: service:jmx:rmi://DESKTOP-1GC2MH1 Disconnected from the target VM, address: '127.0.0.1:56792', transport: 'socket' Process finished with e

关于metaspolit中进行JAVA反序列化渗透RMI的原理分析

一.背景: 这里需要对java反序列化有点了解,在这里得推广下自己的博客嘛,虽然写的不好,广告还是要做的.原谅我: 1.java反序列化漏洞原理研习 2.java反序列化漏洞的检测 二.攻击手法简介 针对这个使用msf攻击需要大家看一篇文章:JMX RMI Exploit 实例 , 鸣谢,确实学到了很多,膜拜大牛 , 简要介绍下攻击手法: (1)下载mjet模块:下载连接mjet,如果是mac电脑安装好metaspolit以后可以直接使用git clone命令下载到metaspolit的父目录下

Tomcat配置JMX远程监控(Windown7 Linxu)

一:Window7下配置方式. 1.配置catalina.bat 在第一行加入下面配置 注意下面这些配置要在一行,注意包含空格. set JAVA_OPTS=-Dcom.sun.management.jmxremote -Djava.rmi.server.hostname=192.168.10.126 -Dcom.sun.management.jmxremote.port=9008 -Dcom.sun.management.jmxremote.authenticate=true -Dcom.su

JMX与Spring

1.什么是JMX JMX可以监控类的运行情况,可以在程序运行期查看并修改类属性的信息. 举一个应用实例:在一个系统中常常会有一些配置信息,比如服务的IP地址,端口号什么的,那么如何来写这些代码呢? 下面是一段摘自http://blog.csdn.net/xiaojianpitt/article/details/2961695: 程序初哥一般是写死在程序里,到要改变时就去改程序,然后再编译发布: 程序熟手则一般把这些信息写在一个配置文件里(JAVA一般都是*.properties文件),到要改变时

cassandra高级操作之JMX操作

需求场景 项目中有这么个需求:统计集群中各个节点的数据量存储大小,不是记录数. 一开始有点无头绪,后面查看cassandra官方文档看到Monitoring章节,里面说到:Cassandra中的指标使用Dropwizard Metrics库进行管理. 这些指标可以通过JMX查询,也可以使用多个内置和第三方报告插件推送到外部监控系统(Jconsole).那么数据量存储大小是不是也是cassandra的某项指标了? 带着疑问,我通过Jconsole看到了cassandra的一些指标(先启动cassa

JMX远程监控JVM

远程监控JVM状态需要在JVM启动的时候需要加上一段代码开启这个功能.(以下全部以ubuntu-14-04-server.jdk1.8.tomcat7.0环境为基础) 配置的时候分两种情况:1.无需配置用户访问权限:2.需要配置用户访问权限 先看第一种:首先更改tomcat启动参数(vim catalina.sh)找到 # OS specific support. $var _must_ be set to either true or false. 添加如下变量:JAVA_OPTS="-Dco

运用JMX监控Tomcat

1.先配Tomcat的启动语句,window下tomcat的bin/catalina.bat(linux为catalina.sh),在头上注释部分(.bat为rem..sh为#)后面加上set JAVA_OPTS=-Dcom.sun.management.jmxremote.port=8999 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=true (linux为JAVA_

ActiveMQ5.10.2版本配置JMX

ActiveMQ的特性之一是很好的支持JMX.通过JMX MBeans可以很方便的监听和控制ActiveMQ的broker. 鉴于官方网站提供的JMX特性说明对于远程访问的配置流程不是很完整,笔者在实际配置时也走了一点弯路.所以本文将根据笔者的实际经验,分别讲解如何在windows和Linux环境下配置ActiveMQ的JMX远程访问.除此之外,还会从“是否是密码保护”的方面讲解. 本文的JMX客户端环境为Windows7下的JDK1.7. 没有密码保护的远程访问 没有密码保护的远程访问的配置很