Installation - Startup Parameters for Java Agent on a Tomcat Application Server


Tomcat Compatibility

vFunction supports Apache Tomcat version 6 and later.


Installation Workflow

  1. Install the Dynamic Analysis Controller
  2. Find and note the base path to your Tomcat Application Server

    ### This should return the location of the bin/setenv.sh which should be in the Tomcat Application Server's CATALINA_HOME

    find / -name 'setenv.sh' -type f
  3. Add the startup parameters to your Tomcat Application Server's CATALINA_OPTS:

    ### Replace the INSTANCE_NAME and CATALINA_HOME below with the actual value

    cat etc/sysconfig/vfunction/agent/instances/INSTANCE_NAME/vmargs-examples/tomcat >> CATALINA_HOME/bin/setenv.sh
  4. Restart the Tomcat instance
  5. Confirm that the Application comes up and functions as expected
  6. If any issues arise:

Sample contents of vmargs-example/tomcat file

If using this sample below, you will need to:

  1. Find-and-replace the REPLACE_BASE_DIR with the value relevant to your vFunction installation
  2. Find-and-replace the REPLACE_INSTANCE with the value relevant to your vFunction installation

This sample file exists in the Installation TGZ in /opt/vfunction/controller-installation/stuff/agent/vmargs-examples/java/tomcat. Once the install.sh script is run, the relevant placeholder fields are replaced in the version of the environmentally-specific file in /etc/sysconfig/vfunction/agent/instances/INSTANCE_NAME/tomcat.

Sudo Installation Sample
# vFunction

VFUN_OPTS="-agentpath:REPLACE_BASE_DIR/opt/vfunction/agent/libJVMTIAgent.so -javaagent:REPLACE_BASE_DIR/opt/vfunction/agent/runtime-agent.jar REPLACE_EXTRA_JVM -Dcom.vfunction.instance=REPLACE_INSTANCE"

export CATALINA_OPTS="$VFUN_OPTS $CATALINA_OPTS"
Sudoless Installation Sample
# vFunction

VFUN_OPTS="-agentpath:REPLACE_BASE_DIR/opt/vfunction/agent/libJVMTIAgent.so=conf=REPLACE_BASE_DIR/etc/sysconfig/vfunction/agent/instances/REPLACE_INSTANCE/native-conf.json -javaagent:REPLACE_BASE_DIR/opt/vfunction/agent/runtime-agent.jar=ConfigLocation=REPLACE_BASE_DIR/etc/sysconfig/vfunction/agent/instances/REPLACE_INSTANCE/vfunction-runtime-override.properties  REPLACE_EXTRA_JVM -Dcom.vfunction.runtime.shared.folder=REPLACE_BASE_DIR/opt/vfunction/controller/instances/REPLACE_INSTANCE/temp/ -Dcom.vfunction.runtime.offload.tmpFolder=REPLACE_BASE_DIR/opt/vfunction/agent/instances/REPLACE_INSTANCE/temp/ -Dcom.vfunction.logging.logFile=REPLACE_BASE_DIR/var/log/vfunction/instances/REPLACE_INSTANCE/vfagent.log"

export CATALINA_OPTS="$VFUN_OPTS $CATALINA_OPTS"

Why use the CATALINA_OPTS instead of JAVA_OPTS?

The key difference between the JAVA_OPTS and CATALINA_OPTS is how widespread each environmental variable will be applied. Any change to the JAVA_OPTS will be applied to all the running Tomcat instances. Any change to the CATALINA_OPTS will be applied only to the single Tomcat instance. For vFunction, it is best to use the CATALINA_OPTS to apply the vFunction Agent only to the single Tomcat instance.