Define agent paths for Java application servers for Splunk Observability Cloud 🔗
To instrument your Java application for Splunk Observability Cloud, you must define the path to the agent from the Splunk Distribution of OpenTelemetry Java. The following sections describe how to set the agent path for each of the supported servers.
JBoss EAP and WildFly 🔗
Follow the instructions for your deployment mode.
Standalone mode 🔗
Add the javaagent
argument to the standalone configuration file:
On Linux add the following line at the end of the standalone.conf file:
JAVA_OPTS="$JAVA_OPTS -javaagent:/path/to/splunk-otel-javaagent.jar"
On Windows, add the following line at the end of the standalone.conf.bat file:
set "JAVA_OPTS=%JAVA_OPTS% -javaagent:<Drive>:\path\to\splunk-otel-javaagent.jar"
Domain mode 🔗
Edit the domain.xml file to add the following option under server-groups.server-group.jvm.jvm-options
:
<option value="-javaagent:/path/to/splunk-otel-javaagent.jar"/>
For more information, see the Red Hat documentation .
Note
Make sure to install the Java agent at each of the Server Group levels.
Jetty 🔗
Add the path to the JVM agent using the -javaagent
argument:
java -javaagent:/path/to/splunk-otel-javaagent.jar -jar start.jar
Alternatively, you can add the -javaagent
argument to your jetty.sh or start.ini files:
If you use the jetty.sh file to start Jetty, add the following line to the <jetty_home>/bin/jetty.sh file:
JAVA_OPTIONS="${JAVA_OPTIONS} -javaagent:/path/to/splunk-otel-javaagent.jar"
If you use the start.ini file to define JVM arguments, add the
javaagent
argument below the--exec
option:#=========================================================== # Sample Jetty start.ini file #----------------------------------------------------------- --exec -javaagent:/path/to/splunk-otel-javaagent.jar
Glassfish and Payara 🔗
Add the path to the JVM agent to the settings using the asadmin command-line tool:
On Linux, enter the following command:
<server_install_dir>/bin/asadmin create-jvm-options "-javaagent\:/path/to/splunk-otel-javaagent.jar"
On Windows, enter the following command:
<server_install_dir>\bin\asadmin.bat create-jvm-options '-javaagent\:<Drive>\:\\path\\to\\splunk-otel-javaagent.jar'
You can also add the -javaagent
argument from the Glassfish or Payara Admin Console:
Open the GlassFish Admin Console at
http://localhost:4848
.Go to
, then .Select
.Select
, then .In the blank field, enter the path to the splunk-otel-javaagent.jar file:
-javaagent:/path/to/splunk-otel-javaagent.jar
Select Save and restart the server.
Note
Make sure that the domain.xml file in your domain directory contains a <jmv-options>
entry for the agent.
Tomcat and TomEE 🔗
Add the path to the JVM agent to your Tomcat or TomEE startup script:
On Linux, add the following line to the <tomcat_home>/bin/setenv.sh
file:
CATALINA_OPTS="$CATALINA_OPTS -javaagent:/path/to/splunk-otel-javaagent.jar"
On Windows, add the following line to the <tomcat_home>\bin\setenv.bat
file:
set CATALINA_OPTS=%CATALINA_OPTS% -javaagent:"<Drive>:\path\to\splunk-otel-javaagent.jar"
Note
When running Tomcat as a Windows service, the setenv.bat script is not used. To add the Java agent to your Tomcat Windows service, run the tomcat<version-number>w.exe utility as an administrator, then add the -javaagent
argument to the list of Java Options.
WebLogic 🔗
Add the path to the JVM agent to your WebLogic domain startup script:
On Linux, add the following line to the <domain_home>/bin/startWebLogic.sh file:
export JAVA_OPTIONS="$JAVA_OPTIONS -javaagent:/path/to/splunk-otel-javaagent.jar"
On Windows, add the following line to the <domain_home>binstartWebLogic.cmd file:
set JAVA_OPTIONS=%JAVA_OPTIONS% -javaagent:"<Drive>:\path\to\splunk-otel-javaagent.jar"
Note
For managed server instances, add the -javaagent
argument using the admin console.
WebSphere Liberty Profile 🔗
Add the path to the JVM agent to the jvm.options file:
Open the jvm.options file: - For a single server, create or edit the
${server.config.dir}/jvm.options
file. - For all servers, create or edit the${wlp.install.dir}/etc/jvm.options
file.Add the following line:
-javaagent:/path/to/splunk-otel-javaagent.jar
Save the file and restart the server.
Note that WebSphere Liberty servers on mainframes is not supported.
WebSphere Traditional 🔗
Open the WebSphere Admin Console and follow these steps:
Navigate to Servers, then Server type.
Select WebSphere application servers.
Select the desired server.
Navigate to Java and Process Management, then Process Definition.
Select Java Virtual Machine.
In the Generic JVM arguments field, enter the path to Splunk Java agent:
-javaagent:/path/to/splunk-otel-javaagent.jar
Select OK. When asked, save the main configuration and restart the server.