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

Java APM on Windows

  • 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 Windows Install Guide.

The steps to Enable Retrace and Restart IIS in the Windows Installation guide can be ignored for Java applications. The Java Profiler is configured differently.

Enable the Java Profiler

The default location for the profiler is C:\Program Files (x86)\stackify\java\lib\stackify-java-apm.jar. Make note of the path and then enable the javaagent option within your JVM application server:

Tomcat

Modify the catalina.bat file located in the installation folder of Tomcat:
set CATALINA_OPTS=%CATALINA_OPTS% -javaagent:"C:\Program Files (x86)\stackify\java\lib\stackify-java-apm.jar"

Wildfly / JBoss

Modify the standalone.conf.bat file:
set JAVA_OPTS=%JAVA_OPTS% -javaagent:"C:\Program Files (x86)\stackify\java\lib\stackify-java-apm.jar"

For JBoss AS7, you also need to include an additional parameter on JAVA_OPTS:
JAVA_OPTS="$JAVA_OPTS -javaagent:"C:\Program Files (x86)\stackify\java\lib\stackify-java-apm.jar" JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=com.stackify.apm"

Jetty

Include the following line to the Jetty start command between java and -jar %JETTY_HOME%/start.jar:
-javaagent:"C:\Program Files (x86)\stackify\java\lib\stackify-java-apm.jar"

Glassfish

Add the following line to the java-config section of the Glassfish domain.xml file:
<jvm-options>-javaagent:"C:\Program Files (x86)\stackify\java\lib\stackify-java-apm.jar"</jvm-options>

WebSphere

Create a text file named jvm.options under WEBSPHERE/usr/servers/SERVER with:
-javaagent:"C:\Program Files (x86)\stackify\java\lib\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:"C:\Program Files (x86)\stackify\java\lib\stackify-java-apm.jar"'

Play Framework 2.x+

Run the application with the following argument:
-J-javaagent:"C:\Program Files (x86)\stackify\java\lib\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?