Apache Tomcat

How to extract Tomcat MBean values at startup?

MBeans are managed beans, Java objects that represent resources to be managed. Tomcat exposes its resource to be managed directly through MBean attributes and operations. To get more insight on MBeans, folow this link.

Tomcat calls a lifecycle listener just before it starts listening to a predefined port. In order to extract all MBean values, you can implement org.apache.catalina.LifecycleListener. For convenience, I have implemented that class with required code and compiled into a jar that will help to do the job. There are a few simple steps to extract all Mbean values during Tomcat Startup.

  • Include below lines in server.xml at the end before tag
<Listener className="com.middlewareworld.tomcat.properties.TomcatMBeanExtractor"/>
  • Start the Tomcat

Once Startup is completed, you can find the file under : /tmp/tomcatProperties.xml

Leave a Reply

Your email address will not be published. Required fields are marked *