• google plus

How to Configure Apache Tomcat to Use MBeans (Windows)

Java Management Extensions (JMX) is a technology that permits applications to expose properties and operations through managed beans, or "MBeans". Tomcat supports JMX and provides numerous MBeans to a consumer program, such as jconsole, that expose useful properties and operations. But in order to access Tomcat's MBeans we must configure Tomcat to expose the MBeans to consumers.

To learn how to configure Apache Tomcat to use MBeans in Windows follow these four steps:

  1. Stop the Tomcat server.
  2. Create a new file named CATALINA_HOME/bin/setenv.bat, e.g., c:/Tomcat8/bin/setenv.bat. Open the file for edit. Add the following line:
    set CATALINA_OPTS=-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9009 
    		-Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false	
    	
    Here you are setting properties that will activate the MBeans the next time you start Tomcat. Note that I have arbitrarily assigned 9009 to the JMX port. There is nothing magic about this value, any available port number will suffice. Also note that fpr testing convenience I have not enabled SSL. In practice, SSL should be used when activating MBeans. Visit this link for a discussion of how to use SSL with MBeans.
  3. Save your changes.
  4. Start the Tomcat server. Your server is now configured to use MBeans.
Author: Stephen Withrow

Stephen has over 30 years' experience in training, development, and consulting in a variety of technology areas including Java, C, C++, XML, JavaScript, AJAX, Tomcat, JBoss, Oracle, and DB2. His background includes design and implementation of business solutions on client/server, Web, and enterprise platforms. Stephen is a published writer in both technical and non-technical endeavors. Stephen received an undergraduate degree in Computer Science and Physics from Florida State University.

About Webucator

Webucator provides instructor-led training to students throughout the US and Canada. We have trained over 90,000 students from over 16,000 organizations on technologies such as Microsoft ASP.NET, Microsoft Office, Azure, Windows, Java, Adobe, Python, SQL, JavaScript, Angular and much more. Check out our complete course catalog.