How to Configure Apache Tomcat to Use MBeans (Linux)

See Apache: Tips and Tricks for similar articles.
Looking to improve your Linux skills? Check out Webucator’s Linux classes.

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 Linux follow these steps:

  1. Stop the Tomcat server.
  2. Create a new file named CATALINA_HOME/bin/setenv.sh, e.g., /usr/share/tomcat7/bin/setenv.sh. Open the file for edit. Add the following line:
    export 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.

Related Articles

  1. How to Start and Stop Apache Tomcat from the Command Line (Windows)
  2. How to Deploy a WAR File to Apache Tomcat (Windows)
  3. How to Start and Stop Apache Tomcat from the Command Line (Linux)
  4. How to Deploy a WAR File to Apache Tomcat (Linux)
  5. How to Run a JSP Program in Apache Tomcat (Windows)
  6. How to Check the Status of the Apache Tomcat Server (Windows)
  7. How to Deploy a Web Application Using the Apache Tomcat Manager (Windows)
  8. How to Check the Status of the Apache Tomcat Server (Linux)
  9. How to Set Default Context Path in Apache Tomcat (Windows)
  10. How to Use the autoDeploy Attribute in Apache Tomcat (Windows)
  11. How to Deploy a Web Application Using the Apache Tomcat Manager (Linux)
  12. How to List Deployed Applications Using the Apache Tomcat Manager (Windows)
  13. How to Run Multiple Instances of Apache Tomcat on One Server (Windows)
  14. How to Run a JSP Program in Apache Tomcat (Linux)
  15. How to Establish a JDBC Connection in Apache Tomcat (Windows)
  16. How to Verify Apache Tomcat Server Operation (Windows)
  17. How to Cluster in Apache Tomcat (Linux)
  18. How to Undeploy Web Applications Using the Apache Tomcat Manager (Windows)
  19. How to Set Default Context Path in Apache Tomcat (Linux)
  20. How to Use the Java Logging API in Apache Tomcat (Windows)
  21. How to Cluster in Apache Tomcat (Windows)
  22. How to Use the Java Logging API in Apache Tomcat (Linux)
  23. How to Use the autoDeploy Attribute in Apache Tomcat (Linux)
  24. How to Configure Apache Tomcat to Use MBeans (Windows)
  25. How to List Deployed Applications Using the Apache Tomcat Manager (Linux)
  26. How to Install and Configure Apache Tomcat (Windows)
  27. How to Configure Apache Tomcat to Use MBeans (Linux) (this article)