如何管理JMX Web应用程序

时间:2022-06-15 21:02:17

I've gone through the process on this page to expose the JMX interface of a web application.

我已经浏览了此页面上的过程以公开Web应用程序的JMX界面。

I've managed to view the exposed interface on the Tomcat JMX proxy but when I load JConsole and look for the exposed mbean interface I can't find anything related to the attributes and operations exposed.

我已经设法在Tomcat JMX代理上查看公开的接口,但是当我加载JConsole并查找公开的mbean接口时,我找不到与公开的属性和操作相关的任何内容。

Thre is no specific entry on jconsole for the web app so I figured it might be under the TOMCAT jmx entry. It's not. (bare in mind, I did manage to see it on the tomcat jmx proxy page).

在网络应用程序的jconsole上没有特定条目,所以我认为它可能在TOMCAT jmx条目下。不是。 (记住,我确实设法在tomcat jmx代理页面上看到它)。

How can I manage my web application locally? Why is JConsole not showing it?

如何在本地管理我的Web应用程序?为什么JConsole没有显示它?

1 个解决方案

#1


3  

I've managed to fix this by doing a few basic steps -

我已经设法通过做一些基本步骤来解决这个问题 -

  1. In the webapp context listener contextInitialized method, I instantiated a singleton class that will run and implement the mbean (the servlet itself cannot implement an mbean because it only wakes up to take requests from the server).
  2. 在webapp上下文侦听器contextInitialized方法中,我实例化了一个将运行并实现mbean的单例类(servlet本身无法实现mbean,因为它只会唤醒来自服务器的请求)。

  3. The servlet "informs" the singleton of every operation that we want to monitor and the singleton is the one that actually reports this through jmx.
  4. servlet“通知”我们要监视的每个操作的单例,单例是通过jmx实际报告的单例。

  5. In the singleton I registered with the mbean server with this command:

    在使用此命令在mbean服务器上注册的单例中:

    ManagementFactory.getPlatformMBeanServer().registerMBean(this, name);

Thats it. (In a nut shell)

而已。 (简而言之)

#1


3  

I've managed to fix this by doing a few basic steps -

我已经设法通过做一些基本步骤来解决这个问题 -

  1. In the webapp context listener contextInitialized method, I instantiated a singleton class that will run and implement the mbean (the servlet itself cannot implement an mbean because it only wakes up to take requests from the server).
  2. 在webapp上下文侦听器contextInitialized方法中,我实例化了一个将运行并实现mbean的单例类(servlet本身无法实现mbean,因为它只会唤醒来自服务器的请求)。

  3. The servlet "informs" the singleton of every operation that we want to monitor and the singleton is the one that actually reports this through jmx.
  4. servlet“通知”我们要监视的每个操作的单例,单例是通过jmx实际报告的单例。

  5. In the singleton I registered with the mbean server with this command:

    在使用此命令在mbean服务器上注册的单例中:

    ManagementFactory.getPlatformMBeanServer().registerMBean(this, name);

Thats it. (In a nut shell)

而已。 (简而言之)