在 Windows 上使用 JDK 1.4 监控 Tomcat 5.5

发布于 2024-09-13 22:14:32 字数 1387 浏览 1 评论 0原文

根据此文档 http://tomcat.apache.org/tomcat- 5.5-doc/monitoring.html#Enabling_JMX_Remote 应该可以远程监控在 JDK 1.4 上运行的 Tomcat 5.5 服务器,但在搜索了整个网络并尝试了多个操作系统之后,我仍然没有比第一天更进一步。 到目前为止我的结果是。使用标准设置 Tomcat

-Dcom.sun.management.jmxremote 
-Dcom.sun.management.jmxremote.port=%my.jmx.port% 
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.authenticate=false
-Djava.rmi.server.hostname=localhost

在 JDK 1.5 及更高版本上不会出现任何问题。 调试 Tomcat 使我可以访问 MBeanServer,但无法从外部连接到它。根据维基百科的信息 http://en.wikipedia.org/wiki/Java_Management_Extensions 我只需要一个工作连接器,但我不知道如何让它工作。

尝试根据 来设置 HTTP 适配器

<Connector port="${AJP.PORT}" 
            handler.list="mx" 
            mx.enabled="true" 
            mx.httpHost="${JMX.HOST}"
            mx.httpPort="${JMX.PORT}"
            protocol="AJP/1.3" />

根本没有效果。当我调试时,看起来属性 handler.list 和 mx.* 几乎被忽略了。我知道我应该只使用 JDK 1.5,这样我的担忧就会消失,但我们有大量 JDK 1.4 的遗留安装基础,如果我们可以使用 JMX 监控,那就太好了。 最终我想使用 JConsole 或 JVisualVM 连接到 Tomcat,据我所知,连接 URL 看起来像

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

8888 是我的 JMX 端口。 如果有人对如何深入问题的根源有一些建议或想法,那将非常有帮助。

According to this documentation http://tomcat.apache.org/tomcat-5.5-doc/monitoring.html#Enabling_JMX_Remote it should be possible to remotely Monitor a Tomcat 5.5 Server running on a JDK 1.4 but after searching all over the web and trying multiple OSs I still am no further than on day one.
My results thus far are. Settign up Tomcat with the standard

-Dcom.sun.management.jmxremote 
-Dcom.sun.management.jmxremote.port=%my.jmx.port% 
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.authenticate=false
-Djava.rmi.server.hostname=localhost

will work without any problems on JDK 1.5 and up.
Debugging into Tomcat gives me access to the MBeanServer but I am not able to connect to it from the outside. According to the info from Wikipedia http://en.wikipedia.org/wiki/Java_Management_Extensions
I just need a working connector and I have no idea how to get that working.

Trying to set up the HTTP Adaptor according to

<Connector port="${AJP.PORT}" 
            handler.list="mx" 
            mx.enabled="true" 
            mx.httpHost="${JMX.HOST}"
            mx.httpPort="${JMX.PORT}"
            protocol="AJP/1.3" />

has no effect at all. When I debugged it almost seemed like the attributes handler.list and mx.* were just ignored. I know I should just use JDK 1.5 and my worries would be gone but we have a large legacy install base of JDK 1.4 and it would be great if we could use the JMX monitoring.
Eventually I want to use either JConsole or JVisualVM to connect to the Tomcat and as far as I have understood the connection URL would look like

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

were 8888 is my JMX port.
If anyone has some advice or ideas on how to drill to the root of the problem that would be very helpfull.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

但可醉心 2024-09-20 22:14:32

从 1.5 (JDK5) 开始,Java 中就添加了 JMX 支持。要与 JDK 1.4 一起使用,必须下载并安装扩展 http://java.sun.com/javase/technologies/core/mntr-mgmt/javamanagement/download.jsp 。我没有使用它,但这可能是一个起点(来自 http:// java.sun.com/developer/technicalArticles/J2SE/jmx.html

JMX技术实现

Java 2 平台标准版 5.0 (J2SE 5.0) 支持 JMX 1.2 和 JMX Remote API 1.0,后者现在是官方 JMX 参考实现 (RI)。对于运行 J2SE 1.4 的开发人员,Sun Microsystems 还提供 JMX RI,并且可以免费下载。

要从外部连接,请尝试移除线路

-Djava.rmi.server.hostname=localhost

如果您使用的是 Linux,请像 @vinothkr 所说的那样,解决 JMX 远程连接上的 localhost 问题(文件 /etc/hosts,将 127.0.0.1 替换为主机名所在行的服务器 IP)出现服务器的信息)。对于 Windows,我认为同样的事情也适用。

关于连接器,它是您阅读的文档上的jmx远程端口上的连接器。您在协议 AJP/1.3 上的 server.xml 上设置的连接器不相关。它涉及 Apache HTTPd(或其他 Web 服务器/负载均衡器)和 Tomcat 之间的通信。

JMX support had been added to Java since 1.5 (JDK5). To use it with JDK 1.4, an extension have to be dowloaded and installed http://java.sun.com/javase/technologies/core/mntr-mgmt/javamanagement/download.jsp . I did'n used it but that could be a starting point (from http://java.sun.com/developer/technicalArticles/J2SE/jmx.html )

JMX Technology Implementations

The Java 2 Platform, Standard Edition 5.0 (J2SE 5.0) supports JMX 1.2 and JMX Remote API 1.0, which is now the official JMX reference implementation (RI). For developers who are running J2SE 1.4, a JMX RI is also available from Sun Microsystems, and can be downloaded free of charge.

To connect from the outside, try to remove the line

-Djava.rmi.server.hostname=localhost

If your are using Linux, do like @vinothkr said for localhost resolving issue on JMX remote connection (file /etc/hosts, replace 127.0.0.1 with the server IP on the line where the hostname of the server appear). For Windows, I think the same thing could applied.

About the connector, it's the connector on your jmx remote port on the documentation you read. The connector you had setup on server.xml on protocol AJP/1.3 is not related. It concern communication between Apache HTTPd (or other Web Server / Load Balancer) and Tomcat.

浊酒尽余欢 2024-09-20 22:14:32

如果您能够连接到在 Windows 计算机上运行的 JVM。那么问题出在你的hosts.conf上,

尝试hostname -i,如果它报告127.0.0.1,那么就有问题了,

检查这个常见问题解答5。
http://download.oracle.com/javase/1.5 .0/docs/guide/management/faq.html

由于 JMX 使用端口重定向。这会导致问题

If you were able to connect to JVM running on Windows machines. Then the problem is your hosts.conf

Try hostname -i if it reports 127.0.0.1 then there is a problem

Check this FAQ no 5.
http://download.oracle.com/javase/1.5.0/docs/guide/management/faq.html

As JMX uses port redirection. This causes problem

无风消散 2024-09-20 22:14:32

你定义了远程服务器吗?

-Djava.rmi.server.hostname=localhost"

do you have the remote server defined?

-Djava.rmi.server.hostname=localhost"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文