Apache Tomcat — Prerequisites

Prerequisites for monitoring Apache Tomcat with HEAL.

2 min read Updated SS

Prerequisites to complete before adding this component in the HEAL Control Center.

Java Options in the startup file must be modified to enable JMX port. To do so, follow these steps:

  1. Open the <tomcat_home>/bin/setenv.sh on Linux or setenv.cmd in case of Windows systems and add the following directive.NOTE: If the setenv.* file is not available in the Tomcat’s bin folder, you may create it and then add the following lines.Linux/Unix:

    export CATALINA_OPTS=$CATALINA_OPTS "-Djava.rmi.server.hostname=<IP address of Tomcat Computer>
    -Dcom.sun.management.jmxremote=true
    -Dcom.sun.management.jmxremote.port=<JMX port number>
    -Dcom.sun.management.jmxremote.ssl=false
    -Dcom.sun.management.jmxremote.authenticate=true
    -Dcom.sun.management.jmxremote.password.file=<path-to-password-file>
    -Dcom.sun.management.jmxremote.access.file=<path-to-access-file>"
    

    Windows:

    set CATALINA_OPTS=%CATALINA_OPTS% "-Djava.rmi.server.hostname=<IP address of Tomcat Computer>
    -Dcom.sun.management.jmxremote=true
    -Dcom.sun.management.jmxremote.port=<JMX port number>
    -Dcom.sun.management.jmxremote.ssl=false
    -Dcom.sun.management.jmxremote.authenticate=true
    -Dcom.sun.management.jmxremote.password.file=<path-to-password-file>
    -Dcom.sun.management.jmxremote.access.file=<path-to-access-file>"
    

    Note: We are using CATALINA_OPTS instead of JAVA_OPTS to set Tomcat-specific options.w

    Note: When the Tomcat application server is installed as a Service, follow these steps to enable the JMX port:

    1. Log on to the Windows Server on which the Tomcat is installed as Service.
    2. Navigate to Start → Program Menu → Apache Tomcat folder and click Configure Tomcat. The Apache Tomcat <Version> <Service Name> Properties screen is displayed.
    3. Select the Java tab and enter the details in the Java Options section:

      -Djava.rmi.server.hostname=<IP address of Tomcat Computer>
      -Dcom.sun.management.jmxremote=true
      -Dcom.sun.management.jmxremote.port=<JMX port number>
      -Dcom.sun.management.jmxremote.ssl=false
      -Dcom.sun.management.jmxremote.authenticate=true
      -Dcom.sun.management.jmxremote.password.file=<path-to-password-file>
      -Dcom.sun.management.jmxremote.access.file=<path-to-access-file>
      
    4. Click Ok.

    5. Restart the Tomcat Service.

    You should now see the configured port listening for JMX connections.

  2. Restart the Tomcat normally. You should now see the configured port listening for JMX connections.

To determine the Tomcat server’s port number (monitor port):

  1. Open the server.xml file located at <tomcat_home>/bin/conf directory.
  2. Search for the word HTTP Connector Port in the Tomcat’s server.xml file. Tomcat’s default HTTP port is 8080.

Ensure that Tomcat server’s monitor port (default 8080) and JMX port are opened for data collection to collect Tomcat and JVM KPIs.


See also: Apache Tomcat (what HEAL monitors)