Skip to end of metadata
Go to start of metadata

The AppDynamics Java App Server Agent bootstraps using the javaagent command line option. Add this option to your Tomcat catalina.sh or catalina.bat file.

If you are using Tomcat as a Windows service, see Tomcat as a Windows Service Configuration.

To add the javaagent command in a Windows environment

1. Open the catalina.bat file, located at <apache_version_tomcat_install_dir>\bin.

2. Add following javaagent argument to the beginning of your application server start script.

if "%1"=="stop" goto skip_agent
set JAVA_OPTS=%JAVA_OPTS% -javaagent:"Drive:<agent_home>\javaagent.jar"
:skip_agent

(warning) If you are a Self-Service Trial user, add the App Agent for Java javaagent argument to your JVM start script where <my-app-jvm1> is the name you use for the application running on that JVM.

-javaagent:"Drive:<agent_home>\javaagent.jar=uniqueID=<my-app-jvm1>"

The javaagent argument references the full path to the App Server Agent installation directory, including the drive. For details see the screen captures.

Sample Tomcat 5.x catalina.bat file

Sample Tomcat 6.x catalina.bat file

Sample Tomcat 7.x catalina.bat file

3. Restart the application server. You must restart the application server for the changes to take effect.

To add the javaagent command in a Linux environment

1. Open the catalina.sh file located at <apache_version_tomcat_install_dir>/bin.

2. Add the following commands at the beginning of your application server start script.

if [ "$1" = "start" -o "$1" = "run" ]; then
export JAVA_OPTS="$JAVA_OPTS -javaagent:agent_install_dir/javaagent.jar"
fi

The javaagent argument references the full path to the App Server Agent installation directory.

(warning) If you are a Self-Service Trial user, add the App Agent for Java javaagent argument to your JVM start script where <my-app-jvm1> is the name you use for the application running on that JVM.

-javaagent:<agent_home>/javaagent.jar=uniqueID=<my-app-jvm1>

For details see the screen captures.

2a. Sample Tomcat 5.x catalina.sh file

2b. Sample Tomcat 6.x catalina.sh file

3. Restart the application server. The application server must be restarted for the changes to take effect.

2 Comments

  1. Unknown User (tdepuy@xmatters.com)

    What is the process for tomcat 7? My tomcat 7 instance on Fedora does not have a catalina.sh. 

    1. Unknown User (semery@entertainmentpartners.com)

      Our tomcat install in RHEL 5/6 has a catalina.sh file. I use these settings, mainly to maintain FQDN names and fix any class clashing that our apps have:

      #AppDynamics Tomcat 7.x

      if [ "$1" = "start" -o "$1" = "run" ]; then

      export JAVA_OPTS="$JAVA_OPTS -javaagent:/opt/appagent/javaagent.jar -Dappdynamics.agent.uniqueHostId=HOSTNAME.DOMAIN -Dappdynamics.bciengine.class.lookahead=!*"

      fi