Java APM with Linux
  • Updated on 07 Nov 2019
  • 1 minute to read
  • Contributors
  • Print
  • Share
  • Dark
    Light

Java APM with Linux

  • Print
  • Share
  • Dark
    Light

This document details how to install the Java APM Profiler in your Java application running on Linux.

Prerequisite

Follow the Retrace Linux Install Guide.

Enable the Stackify Java Profiler

The Stackify Java Profiler is enabled by the -javaagent JVM option:

Tomcat

Modify catalina.sh or setenv.sh:
CATALINA_OPTS="$CATALINA_OPTS -javaagent:/usr/local/stackify/stackify-java-apm/stackify-java-apm.jar"

Wildfly / JBoss

Modify standalone.conf:
JAVA_OPTS="$JAVA_OPTS -javaagent:/usr/local/stackify/stackify-java-apm/stackify-java-apm.jar"

Jetty

Modify jetty.sh:
JAVA_OPTIONS="$JAVA_OPTIONS -javaagent:/usr/local/stackify/stackify-java-apm/stackify-java-apm.jar"

Glassfish

Add the following line to the java-config section of the Glassfish domain.xml file:
<jvm-options>-javaagent:"/usr/local/stackify/stackify-java-apm/stackify-java-apm.jar"</jvm-options>

WebSphere

Create a jvm.options under WEBSPHERE/usr/servers/SERVER with:
-javaagent:/usr/local/stackify/stackify-java-apm/stackify-java-apm.jar

Depending on your preferences, you may configure a single JVM or all Liberty JVMs with your options file.

  • To apply these settings to a single server, save jvm.options at ${server.config.dir}/jvm.options
  • To apply these changes to all Liberty JVMs, save jvm.options at: ${wlp.install.dir}/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:/usr/local/stackify/stackify-java-apm/stackify-java-apm.jar'

Play Framework 2.x+

Run the application with the following argument:
-J-javaagent:/usr/local/stackify/stackify-java-apm/stackify-java-apm.jar

Configure Application

Create a stackify-api.properties file inside your application's classpath with the following contents:

stackify.application=My Java Application 
stackify.environment=Production

Restart Your Web Server
After modifying your configuration, you must now restart your application server.
Was this article helpful?