How to Use jconsole to Access MBeans (Linux)
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.
To learn how to use MBeans in Windows follow these steps:
- You'll need to activate MBeans in Tomcat. For instructions for configuring Tomcat to use MBeans, .
- Start the Tomcat server.
- Open a command prompt.
- At the command prompt, type
jconsoleand press Enter.
- 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:
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.
- The main page will now be displayed. Click the MBeans tab.
- 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
- 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
examplesweb application that is shipped with Tomcat. Open WebModule -> //localhost/examples -> none -> none -> Operations -> addWelcomeFile as illustrated below:
addWelcomeFileoperation will add a welcome file entry (e.g.,
default.jsp) to the
examplesweb application. To invoke the operation, click the addWelcomeFile button. Note that
stopoperations are also available on the list of operations. A
stopoperation 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
startoperation will start the web application so that browsers can interact with the website.