• Print
  • Share
  • Dark
    Light

Enabling the Java Agent

  • Updated on 20 Jun 2018
  • 1 minute to read
  • Contributors

Configuring your application to work is a two step process. You must first install Retrace and then enable the javaagent within your JVM application server.

Depending on if you are using Windows or Linux, you will first need to note the path to the stackify-java-apm.jar file.

  • Linux: /usr/local/stackify/stackify-java-apm/stackify-java-apm.jar
  • Windows: C:\Program Files (x86)\stackify\java\lib\stackify-java-apm.jar

Remember to Restart Your App!
After changing the configuration to enable the java agent, make sure you restart your application server. This is required before profiling will work properly.

Tomcat

Linux

Modify the catalina.sh file located in the installation folder of Tomcat.

CATALINA_OPTS="$CATALINA_OPTS -javaagent:enter_path_stackify_apm_jar"

Windows

Modify the catalina.bat file located in the installation folder of Tomcat.

set CATALINA_OPTS=%CATALINA_OPTS% -javaagent:"enter_path_stackify_apm_jar"

Wildfly / JBoss

Linux

Modify the standalone.conf file.

JAVA_OPTS="$JAVA_OPTS -javaagent:enter_path_stackify_apm_jar"

Windows

Modify the standalone.conf.bat file.

set JAVA_OPTS=%JAVA_OPTS% -javaagent:"enter_path_stackify_apm_jar"

For JBoss AS7, you also need to include an additional parameter on the JAVA_OPTS.

JAVA_OPTS="$JAVA_OPTS -javaagent:enter_path_stackify_apm_jar" JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=com.stackify.apm"

Jetty

Modify the jetty.sh file.

Linux

Modify the jetty.sh file.

JAVA_OPTIONS="$JAVA_OPTIONS -javaagent:enter_path_stackify_apm_jar"

Windows

Include the following line to the Jetty start command between java & -jar %JETTY_HOME%/start.jar.

-javaagent: "enter_path_stackify_apm_jar"

Glassfish

Linux or Windows

Add the following line to the java-config section of the Glassfish domain.xml file.

<jvm-options>-javaagent:"enter_path_stackify_apm_jar"</jvm-options>

WebSphere

Linux or Windows

  1. Create a text file named jvm.options under WEBSPHERE/usr/servers/SERVER
  2. Insert the javaagent argument into this file.
-javaagent:enter_path_stackify_apm_jar
  1. Depending on your preferences, you might configure a single JVM or all Liberty JVMs with your options file.
    • To apply these settings to a single server, save jvm.optionsat:$/jvm.options
    • To apply these changes to all Liberty JVMs, save jvm.options at:$/etc/jvm.options This will take effect for all JVMs that do not have a locally defined jvm.options file.

Play Framework 1.2.x-1.4.x

Before running your application, enter the following command:

export JAVA_OPTS='-javaagent:enter_path_stackify_apm_jar'

Then start the app:

./play run {app_name}

Play Framework 2.x+

Run the application with the following argument:

-J-javaagent:enter_path_stackify_apm_jar

Example:

sbt run -J-javaagent:enter_path_stackify_apm_jar