无法通过Java6中的jconsole连接到Tomcat的MBeanServer [英] Cannot connect to Tomcat's MBeanServer via jconsole in Java6

查看:201
本文介绍了无法通过Java6中的jconsole连接到Tomcat的MBeanServer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在远景机器上。我已经使用以下选项启动了tomcat 5.5.27:

I'm on a vista machine. I've started tomcat 5.5.27 with these options:

CATALINA_OPTS="-Dcom.sun.management.jmxremote.port=9003 \
    -Dcom.sun.management.jmxremote.ssl=false \
    -Dcom.sun.management.jmxremote.authenticate=false"

当我通过jconsole连接并添加以下服务网址

When I connect via jconsole and added the following service url

service:jmx:rmi:///jndi/rmi://localhost:9003/jmxrmi

它不会连接。有什么想法吗?

it would not connect. Any ideas ?

推荐答案

好吧,我原则上认为op给出的URL是错误的但事实并非如此。所以我无法回答。

Ok, I orignally supposed the URL given by op was wrong but it turns out no. So I can't answer.

不过,以下是基础知识:

Still, here are the basics:

通过<进行简单连接code> JConsole的。

如果您知道您要连接的JMX服务器在9003处具有 RMI注册表端口,例如,连接使用

If you know that the JMX Server you want to connect to has the RMI registry port at 9003 for example, connect using

localhost:9003

而不是。

否则,这是我从头开始发现的:

Otherwise, here's what I found out from the ground up:

假设您使用RMI REGISTRY PORT中的 RMI注册表端口在TARGET MACHINE上运行JMX Server(别名'JMX Agent'别名'您要连接的JVM') 'JMX RMI SERVER PORT'上的 JMX RMI服务器端口

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'.

注意:


  1. RMI注册表告诉JMX客户端在哪里可以找到 JMX RMI服务器端口;信息可以在密钥 jmxrmi 下获得。

  2. RMI注册表端口通常被称为已设置通过JVM启动时的系统属性。

  3. JMX RMI服务器端口通常,因为JVM随机选择它(如果没有采取其他预防措施)。

  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).

以下URI将导致成功(测试)

The following URI will lead to success (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.

这个URI是RFC2609服务位置协议URL(嗯,它真的是一个URI,对吗?)

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

它由以下内容组成:


  • service - a常量

  • jmx:rmi - 服务类型由以下组成:抽象类型 jmx URL计划 rmi

  • 其余的 - sap (服务访问协议规范)

  • 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 是分解为:


  • //< TARGET_MACHINE>:< JMX_RMI_SERVER_PORT> - ipsite

  • / jndi / rmi://< TARGET_MACHINE>:< RMI_REGISTRY_PORT> / jmxrmi - 网址

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

一个消息灵通的JMX客户端连接到ipsite以进行JMX-over-RMI交换;但是什么JMX客户端不知道该端口?耐心...

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部分被分解为:


  • / jndi / - 这似乎告诉JMX客户端它可以在后面的位置获取查找信息

  • rmi://< TARGET_MACHINE>:< RMI_REGISTRY_PORT> / jmxrmi - 是的,我们在查找键<$下获取有关RMI注册表中JMX RMI服务器的信息c $ c> jmxrmi

  • /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

这有点像马车,因为必须联系 RMI注册表首先由SLP URL的后者部分提供。

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

是的,这有效!从注册表中很好地获得了JMX RMI服务器端口。再想一想,目标机器也应该从注册表中获取,因此:

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

更好的是,这也有效!

参考文献:

1 download.oracle.com/javase/6/docs/api/javax/management/remote/rmi/package-summary.html
2 download.oracle.com/javase/6/docs/api/javax/management/remote/JMXServiceURL.html
3 mx4j.sourceforge.net/docs/ch03s04.html
4 download.oracle.com/javase/6/docs/technotes/guides/management/agent.html#gdevg
5 http://www.rfc-editor.org/rfc/rfc2609.txt

这篇关于无法通过Java6中的jconsole连接到Tomcat的MBeanServer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆