问题描述
我需要为tomcat服务器创建一个容器级JMX MBean,以允许企业级监视一些自定义功能.
I need to create a container level JMX MBean for tomcat servers to allow enterprise level monitoring of a few custom features.
我在网上找到的示例集中在webapp级别的MBean.我找到了一些有关Tomcat 5的示例,但此后似乎发生了很多变化.
The examples I am finding online are focused on webapp level MBeans. I found a few examples for Tomcat 5, but it looks like a lot has changed since then.
如何为整个Tomcat实例注册MBean?
How can I register an MBean for an entire Tomcat instance?
推荐答案
我通过添加所需的描述符并在web.xml中为容器添加了侦听器来解决.由于该容器中的每个应用程序都会调用侦听器,因此有必要测试此场景中是否已存在bean.
I solved by adding the required descriptor AND putting a listener in web.xml for the container. It was necessary to test whether bean already existed in this sceario, since the listener is called for each app in the container.
这篇关于Tomcat 7+中的容器级别的自定义JXM MBean的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!