• /
  • Log in
  • Free account

Include the Java agent with a JVM argument

This document describes how to pass the -javaagent argument to the JVM for your framework. This installation step ensures the agent is included in your app. For all app servers, ensure you pass the full path to the newrelic.jar file.

This document is simply a reference for how to pass the argument. For detailed installation procedures, see Java agent installation.

Coldfusion

To pass the -javaagent argument on Coldfusion:

  1. Start your ColdFusion server and navigate to your ColdFusion admin console.

  2. From the left menu, select SERVER SETTINGS > Java and JVM.

  3. If using the agent API: Specify the path to newrelic-api.jar in the ColdFusion Class Path field.

  4. In the JVM Arguments field, add the -javaagent argument:

    -javaagent:/full/path/to/newrelic.jar
  5. Select Submit Changes, then restart your ColdFusion server.

Geronimo

To pass the -javaagent argument on Geronimo, refer to the New Relic agent jar in the JAVA_OPTS environment variable when running the startup command:

export JAVA_OPTS="$JAVA_OPTS -javaagent:/full/path/to/newrelic.jar" && geronimo run

Glassfish

To pass the -javaagent argument on Glassfish:

  1. From the Glassfish console, select Application Server > JVM Settings > JVM Options.

  2. On the JVM Options page, select Add JVM Option.

  3. Add an entry for the -javaagent argument:

    -javaagent:/full/path/to/newrelic.jar
  4. Save and restart Glassfish.

If Glassfish does not start, the -javaagent argument might not have been set correctly. You can change the server JVM arguments by editing the domain.xml file.

Important

A bug in Glassfish 2.1 prevents classes on the bootstrap class loader (the New Relic agent) from using the Java logging API. This appears to be fixed in 2.1.1 or higher releases.

Grails

To pass the -javaagent argument on Grails:

JBoss

To pass the -javaagent argument on JBoss:

Jetty

To pass the -javaagent argument on Jetty:

Play

To pass the -javaagent argument on Play:

Resin

To pass the -javaagent argument on Resin, add it to the <jvm-args> section in your resin.conf or resin.xml file:

<jvm-arg>-javaagent:/full/path/to/newrelic.jar</jvm-arg>

Solr

To pass the -javaagent argument on Solr:

Spring Boot

To pass the -javaagent argument on Spring Boot, add it to the command line in which you start your app. Make sure to add it before the -jar argument:

java -javaagent:/full/path/to/newrelic.jar -jar app.jar

Tanuki Wrapper

To pass the -javaagent argument on Tanuki Wrapper, add a wrapper option wrapper.conf. In the line below, substitute XXX for an unused number in this file:

wrapper.java.additional.XXX=-javaagent:/full/path/to/newrelic.jar

Tip

On Linux systems, no quotation marks are required when setting this value. This behavior may vary on other operating systems.

Tomcat

To pass the -javaagent argument on Tomcat:

WebLogic

To pass the -javaagent argument on WebLogic:

WebSphere

To pass the -javaagent argument on WebSphere:

  1. From the admin console, select Servers > Application servers > (select a server) > Configuration > Service Infrastructure > Java and Process Management.

  2. Select Process Definition > Additional Properties, then select Java Virtual Machine.

  3. In the Generic JVM arguments field, add the -javaagent argument for your newrelic.jar file:

    -javaagent:/full/path/to/newrelic.jar
  4. Select Apply, then select Save.

  5. Restart your server.

For more information, see the documentation about collecting WebSphere PMI metrics.

WebSphere Community

To pass the -javaagent argument on WebSphere Community Edition, refer to the New Relic agent jar in the JAVA_OPTS environment variable when running the startup command:

export JAVA_OPTS="$JAVA_OPTS -javaagent:/full/path/to/newrelic.jar" && startup

WebSphere Liberty Profile

To pass the -javaagent argument on WebSphere Liberty Profile:

  1. Edit ${server.config.dir}/jvm.options.

  2. Add the -javaagent argument to point to your newrelic.jar file:

    -javaagent:/full/path/to/newrelic.jar
  3. Restart your server.

Wildfly

To pass the -javaagent argument on Wildfly (if using Wildfly 11 or higher, see additional install instructions):

Other application servers

The New Relic Java agent works on any supported app server. If your app server is not listed in this document, follow standard procedures for your app server to pass this argument to the JVM before the app jar:

-javaagent:/full/path/to/newrelic.jar

For more help

If you need more help, check out these support and learning resources:

Create issueEdit page
Copyright © 2021 New Relic Inc.