Skip to end of metadata
Go to start of metadata

On this page:

To instrument applications on Apache Tomcat, add the Java Agent JAR location as a Catalina environment, or CATALINA_OPTS variable, as described here. 

Instrument Apache Tomcat

  1. Open (or create if it doesn't already exist) the setenv.sh (Linux) or setenv.bat (Windows) file. For Tomcat 6 and later, you can put the file in the CATALINA_BASE/bin directory. For previous versions of Tomcat, put the file in the CATALINA_HOME/bin directory
  2. Add the -javaagent argument to the file as a Catalina environment variable, as follows. 

    On Linux:

    export CATALINA_OPTS="$CATALINA_OPTS -javaagent:<agent_home>/javaagent.jar"

    Replace <agent_home> with the full path to the Java Agent JAR file.

    For example:

    export CATALINA_OPTS="$CATALINA_OPTS -javaagent:/home/appserver/appagent/javaagent.jar"

    On Windows:

    set CATALINA_OPTS=%CATALINA_OPTS% -javaagent:"Drive:<agent_home>\javaagent.jar"

    For example

    set CATALINA_OPTS=%CATALINA_OPTS% -javaagent:"C:\appagent\javaagent.jar"
  3. Restart the application server. The application server must be restarted for the changes to take effect. For more information on running Tomcat as a service, see Setting Properties and Options on Startup.

Instrument Tomcat When Running as a Windows Service

When running Tomcat as a Windows service, add the javaagent argument to your Tomcat startup properties. These instructions apply to Apache Tomcat 6.x or later versions.

To install the Java agent in Tomcat running as a Windows service
  1. Ensure that you are using administrator privileges.
  2. Click Programs > Apache Tomcat > Configure Tomcat.
  3. Click the Java tab and in the Java Options add:

  4. Restart the Tomcat service to have the changes take effect.