Container level Custom JXM MBean in Tomcat 7+

一个人想着一个人 提交于 2019-12-12 04:55:51

问题


I need to create a container level JMX MBean for tomcat servers to allow enterprise level monitoring of a few custom features.

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.

How can I register an MBean for an entire Tomcat instance?


回答1:


Tomcat already have MBeans for monitoring stuff. You need to enable it via CATALINA_OPTS, just add:

-Dcom.sun.management.jmxremote 
-Dcom.sun.management.jmxremote.port={port to access} 
-Dcom.sun.management.jmxremote.authenticate=false 
-Dcom.sun.management.jmxremote.ssl=false

And then connect to that port via JConsole or VisualVM. Read further.




回答2:


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.



来源:https://stackoverflow.com/questions/29473344/container-level-custom-jxm-mbean-in-tomcat-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!