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:
Start your ColdFusion server and navigate to your ColdFusion admin console.
From the left menu, select SERVER SETTINGS > Java and JVM.
If using the agent API: Specify the path to newrelic-api.jar in the ColdFusion Class Path field.
In the JVM Arguments field, add the -javaagent argument:
-javaagent:/full/path/to/newrelic.jar
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:
bash
$
exportJAVA_OPTS="$JAVA_OPTS -javaagent:/full/path/to/newrelic.jar"&& geronimo run
Glassfish
To pass the -javaagent argument on Glassfish:
From the Glassfish console, select Application Server > JVM Settings > JVM options.
On the JVM options page, select Add JVM option.
Add an entry for the -javaagent argument:
-javaagent:/full/path/to/newrelic.jar
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.
A JBoss bug in 7.0.2.Final and 7.1.0.Alpha1 does not allow JVM options to be set in domain.xml. If you encounter this problem, upgrade your JBoss application server.
Use standalone mode for other platforms and versions:
The module system introduced in Java 9 can lead to the exception NoClassDefFoundError: java/sql/SQLException if the -javaagent property is added to the conf/resin.conf or conf/resin.xml files. If you're using Java 9 or higher make sure that the -javaagent property is not included in those files.
Resin can be run on Java 9 or higher, with the Java agent using one of the following options:
Option 1: Add the javaagent argument via the jvmargs property in server's resin.properties file:
jvm_args:-javaagent:/full/path/to/newrelic.jar
The Resin server can then be run with ./bin/resin.sh start.
Option 2: Run resin jar with the -javaagent property on the command line:
When running Solr in an application server, follow the instructions of that application server to add the -javaagent flag. Also ensure that JMX is enabled for the application server. If you don't see data in the APM UI's Solr page, follow the troubleshooting procedures for Solr data.
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:
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:
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:
Create a CATALINA_BASE/bin/setenv.sh script if one doesn't already exist. Configure your setenv.sh script to use the New Relic agent using the CATALINA_OPTS environment variable:
Create a CATALINA_BASE/bin/setenv.bat script if one doesn't already exist. Configure your setenv.bat script to use the New Relic agent using the CATALINA_OPTS environment variable:
We recommend that you do not set any variables in this script. Instead put them into a script setenv.sh in CATALINA_BASE/bin to keep your customizations separate.
Configure your catalina.sh file to use the New Relic agent using the JAVA_OPTS environment variable:
We recommend that you do not set any variables in this script. Instead put them into a script setenv.bat in CATALINA_BASE/bin to keep your customizations separate.
If you use catalina.bat to launch Tomcat, set the JAVA_OPTS variable near the top of the file:
In the Java Options text box, enter the argument. Use forward slashes / for the path separator. For Tomcat 6, add a line break after the -javaagent argument.
-javaagent:/full/path/to/newrelic.jar
Select Apply, then restart Tomcat.
The version of Apache Commons Daemon (jsvc) included with Tomcat 6 does not support the -javaagent argument used by New Relic. However, a build of the jsvc daemon from the trunk source will support the -javaagent argument via the -X prefix. See the Apache bug tracking the issue.
There is a fix in the Apache Commons source repository. For more information:
For administration server instances, follow the Linux/macOS or Windows instructions. You cannot use the administration console to install administration server instances.
For managed server instances, use the admin console:
From the administration console, navigate to Environments > Servers > (select a server) > Server Start > Arguments.
From Arguments, add:
-javaagent:/full/path/to/newrelic.jar
Save the page, then restart your server instance.
WebSphere
To pass the -javaagent argument on WebSphere:
From the admin console, select Servers > Application servers > (select a server) > Configuration > Service Infrastructure > Java and Process Management.
Select Process Definition > Additional Properties, then select Java Virtual Machine.
In the Generic JVM arguments field, add the -javaagent argument for your newrelic.jar file:
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:
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: