How to Use jconsole to Access MBeans (Linux)

  • google plus

In Brief...

MBeans provide potentially important properties and operations to the Apache Tomcat administrator. In this topic, we'll explore how to access MBeans using the jconsole application that is provided in the JDK.

Take our Apache Tomcat Administration for Windows Training course for free.

See the Course Outline and Register

Instructions

To learn how to use MBeans in Windows follow these steps:

  1. You'll need to activate MBeans in Tomcat. For instructions for configuring Tomcat to use MBeans, .
  2. Start the Tomcat server.
  3. Open a command prompt.
  4. At the command prompt, type jconsole and press Enter.
  5. Select the Catalina JVM by selecting the Remote Process radio button then typing in the IP and port number (separated by a colon) as shown:
    Connect VM for jconsole
    Then click Connect. Since the connection is not through SSL, a warning will be displayed. Click the button labeled Insecure connection. In practice, you'll want to secure access to the MBeans. For more information on securing the JMX port visit the Oracle documentation at https://docs.oracle.com/javase/8/docs/technotes/guides/management/agent.html.
  6. The main page will now be displayed. Click the MBeans tab.
    jconsole MBeans tab
  7. The MBeans main page will be displayed. We'll take a look at the Catalina MBeans. Click the + sign adjacent to Catalina in the left hand panel.
    jconsole MBeans page
  8. Let's follow one branch of the tree to give you an idea of the what can be accomplished using MBeans. We'll locate the operations available for the examples web application that is shipped with Tomcat. Open WebModule -> //localhost/examples -> none -> none -> Operations -> addWelcomeFile as illustrated below:
    jconsole WebModule operations for example web app
    The addWelcomeFile operation will add a welcome file entry (e.g., default.jsp) to the examples web application. To invoke the operation, click the addWelcomeFile button. Note that start and stop operations are also available on the list of operations. A stop operation will stop the web application (attempts to access a stopped web application will result in Tomcat sending an HTTP status of 404 to the browser). A start operation will start the web application so that browsers can interact with the website.

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, XML, Windows, Java, Adobe, HTML5, JavaScript, Angular, and much more. Check out our complete course catalog.

Categories

Courses

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.

Discuss