Jetty
This guide explains how to instrument a Java application developed on Jetty server selecting Linux agent or Windows agent for trace ingestion.
- Linux
- Windows
Prerequisites
- The Motadata Agent must be installed and running on the server where the Jetty-based application is deployed. Also, the otelcol should be running as part of the Motadata Agent. To check the agent status open a Linux terminal and run the below command:
service motadata-agent status
If the agent is not running, restart it using the below command:
service motadata-agent stop
service motadata-agent start
- Java Version Must Be 8 or Higher. To check the version you can use the below command:
java -version
- The Jetty installation directory (i.e.
JETTY_HOME,JETTY_BASE) is available. - Required permissions to edit Jetty startup scripts or configuration files and restart Jetty.
- Ensure the method used to start Jetty such as:
jetty.shstartup script, orstart.iniconfiguration file
- Application should be developed on Jetty Framework version 9.x to 12.x.
You can verify the Jetty version by checking the VERSION.txt file available in the Jetty installation directory.
Configuration Steps
Step1: Register the Application Service in Motadata AIOps
Go to Menu > Settings > APM > Application Registration. Clicking the Application Registration button, you can register a new application.
From the application registration screen, select the instrumentation type Host/VM or Docker.
- Host/VM
- Docker

Java Trace Configuration
| Field | Description |
|---|---|
| Select Agent | Select the Host/VM where this application is running. You can configure Java application service for both Windows and Linux type agent. |
| elect Language | Select Java from the language icons. |
| Service Name | Provide a unique and meaningful name (e.g., ERP). |
| Application Path | Specify the full path to the executable JAR file used to start the application. Ensure the path ends with .jar. (e.g home/motadata/app.jar) |
Providing these details displays Setup Command to instrument your Java application. Add the following argument to your java -jar command and restart the service to collect Traces.
Java Trace Configuration
| Field | Description |
|---|---|
| Select Agent | Select the Docker where this application is running. You can configure Java application service for Linux type agent. |
| Language | Select Java from the language icons. |
| Service Name | Provide a unique and meaningful name (e.g., ERP). |
| Application Path | Specify the full path to the executable JAR file used to start the application. Ensure the path ends with .jar. (e.g home/motadata/app.jar) |
Providing these details displays Setup Command to instrument your Java application. Add the following argument to your java -jar command and restart the service to collect Traces.

Step2: Configure Jetty for Instrumentation
Jetty instrumentation can be done using different methods. Follow the instructions based on how Jetty is started in your environment using CLI.
- Script Method
- Configuration Method
Jetty Started Using jetty.sh
Locate jetty.sh
Find the Jetty startup script at one of the following locations:
<JETTY_HOME>/bin/jetty.sh
Replace the <JETTY_HOME> with your directory path.
for example, your directory is installed at /usr/local/jetty/ path then,
/usr/local/jetty/bin/jetty.sh
Stop Jetty
Use the below command to stop Jetty:
<JETTY_HOME>/bin/jetty.sh stop
Replace the <JETTY_HOME> with your directory path.
Modify jetty.sh
To modify, first navigate to the directory:
cd <JETTY_HOME>/bin
Open the file:
vi jetty.sh
You can use nano if preferred in your organization.
Then, add the following lines near the section where JAVA_OPTIONS is defined:
JAVA_OPTIONS="${JAVA_OPTIONS} \
-javaagent:/motadata/motadata/instrumentation/agents/java/motadata-javaagent.jar
-Dotel.javaagent.configuration-file=/motadata/motadata/config/<ServiceName>.properties
Replace the <ServiceName> part with the exact service name, you have registered in Motadata AIOps.
Alternatively, you can paste the command snippet copied from the Instrumenting Java Application card. Ensure while pasting, your snippet starts with -javaagent: and includes everything up to .properties".
Now, you can Save the file and exit from the editor.
Make sure to add this script near JAVA_OPTIONS without affecting the existing configuration.
Start Jetty
Use the below command to start Jetty:
<JETTY_HOME>/bin/jetty.sh start
Replace the <JETTY_HOME> with your directory path.
Jetty Started Using start.ini
Locate start.ini
The start.ini file is typically located at:
<JETTY_BASE>/start.ini
Replace the <JETTY_BASE> with your directory path.
for example, your directory is installed at /usr/local/jetty/ path then
/usr/local/jetty/start.ini
Stop Jetty
Use the below command to stop Jetty:
<JETTY_HOME>/bin/jetty.sh stop
Replace the <JETTY_HOME> with your directory path.
Modify start.ini
To modify, first open the file using below command:
vi <JETTY_BASE>/start.ini
Ensure the --exec directive is present (this is required to pass JVM arguments).
Add the following lines after the --exec directive:
--exec
-javaagent:/motadata/motadata/instrumentation/agents/java/motadata-javaagent.jar
-Dotel.javaagent.configuration-file="/motadata/motadata/config/<ServiceName>.properties"
Replace the <ServiceName> part with the exact service name, you have registered in Motadata AIOps.
Alternatively, you can paste the command snippet copied from the Instrumenting Java Application card. Ensure while pasting, your snippet starts with -javaagent: and ends with .properties".
While pasting, do not include the java command at the beginning or the -jar path at the end from the copied snippet.
Now, you can Save the file and exit from the editor.
Start Jetty
Use the below command to start Jetty:
<JETTY_HOME>/bin/jetty.sh start
Replace the <JETTY_HOME> with your directory path.
Ensure Jetty starts successfully and the Java agent is loaded without errors.
You can use any other restart method that is standard for your application.
Step3: Configure Attributes and Parameters
After configuring the application, you can provide the below details:
| Field | Description |
|---|---|
| Service Attributes(Tags) | Add key–value tags to your application for better filtering and organizing data in Explorer. Attribute keys must be in lowercase (for example, apm.env = prod). To add multiple Key-Value pairs you can click the add icon. |
| Add Custom Parameters | Allows you to define custom sampling or tagging parameters for advanced use cases. These optional parameters are passed to the agent (for example, version=4). |
Clicking the Apply Configuration button, the ingestion gets started.
Once the Application is Running, you need to verify the below points:
- Confirm that the service has been registered successfully.
- On the service registration screen, the Service Trace Collection Status should display "Running."
- The traces will start appearing in the APM Explorer screen.
Prerequisites
- The Motadata Agent must be installed and running on the server where the Jetty-based application is deployed. To check the agent status open a press Win+R and run the below field:
service.msc
If the agent is not running, by applying Right-click > Start or Restart it.
- Java Version Must Be 8 or Higher. To check the version you can use the below command using Command Prompt:
java -version
- The Jetty installation directory (i.e.
JETTY_HOME) is available. - Required permissions to edit t .bat and .ini files and restart Jetty.
- Ensure the method used to start Jetty such as:
jetty.shstartup script, orstart.iniconfiguration file
- Application should be developed on Jetty Framework version 9.x to 12.x.
You can verify the Jetty version by checking the VERSION.txt file available in the Jetty installation directory.
Configuration Steps
Step1: Register the Application Service in Motadata AIOps
Go to Menu > Settings > APM > Application Registration. Clicking the Application Registration button, you can register a new application.
From the application registration screen, select the instrumentation type as Host/VM.

Java Trace Configuration
| Field | Description |
|---|---|
| Select Agent | Select the Host/VM where this application is running. You can configure Java application service for both Windows and Linux type agent. |
| Select Language | Select Java from the language icons. |
| Service Name | Provide a unique and meaningful name (e.g., ERP). |
| Application Path | Specify the full path to the executable JAR file used to start the application. Ensure the path ends with .jar. (e.g home/motadata/app.jar) |
Providing these details displays Setup Command to instrument your Java application. Add the following argument to your java -jar command and restart the service to collect Traces.

Step 2: Configure Jetty for Instrumentation
Jetty instrumentation on Windows can be done using multiple methods. Follow the instructions based on how Jetty is started in your environment. Choose one method only.
- Direct Startup Command
- jetty.bat Method
- start.ini Method
Jetty Started Using java -jar start.jar
If Jetty is started using a direct command like:
java -jar start.jar
Modify it as follows:
java -javaagent:C:\motadata\motadata\instrumentation\agents\java\motadata-javaagent.jar ^
-Dotel.javaagent.configuration-file=C:\motadata\motadata\config\<ServiceName>.properties ^
-jar start.jar
Replace the <ServiceName> part with the exact service name you registered in Motadata AIOps.
Use this method when Jetty is started manually for Testing, troubleshooting, or in any simple environments.
Jetty Started Using jetty.bat (Recommended)
Use this method if you start Jetty using jetty.bat and want the agent configuration permanently.
Locate jetty.bat
The startup script is typically located at:
%JETTY_HOME%\bin\jetty.bat
Replace the %JETTY_HOME% with your Jetty installation path.
Stop Jetty
Stop Jetty using your standard approach. If you use Jetty’s script:
%JETTY_HOME%\bin\jetty.bat stop
Modify jetty.bat
- Right-click
jetty.bat> Edit - Or open Notepad as Administrator and open the file manually.
Add Motadata Java Agent Configuration
Find the section where JAVA_OPTIONS is defined, then add or append the following line:
set "JAVA_OPTIONS=%JAVA_OPTIONS% ^
-javaagent:C:\motadata\motadata\instrumentation\agents\java\motadata-javaagent.jar ^
-Dotel.javaagent.configuration-file=C:\motadata\motadata\config\<ServiceName>.properties"
Replace the <ServiceName> part with the exact service name you registered in Motadata AIOps.
Make sure to add this script near JAVA_OPTIONS without affecting the existing configuration.
Start Jetty
Restart Jetty using:
%JETTY_HOME%\bin\jetty.bat start
Jetty Started Using start.ini
If your Jetty instance uses start.ini to define JVM options, use this method.
Locate start.ini
The file is typically located at:
%JETTY_HOME%\start.ini
Stop Jetty
Stop Jetty using your standard approach. If you use Jetty’s script:
%JETTY_HOME%\bin\jetty.bat stop
Modify start.ini
Open start.ini and locate the --exec section.
If it does not exist, add it.
Add the following options after --exec:
--exec
-javaagent:C:/motadata/motadata/instrumentation/agents/java/motadata-javaagent.jar
-Dotel.javaagent.configuration-file=C:/motadata/motadata/config/<ServiceName>.properties
Replace the <ServiceName> part with the exact service name you registered in Motadata AIOps.
Start Jetty
Start Jetty using your standard method. If you use Jetty’s script:
%JETTY_HOME%\bin\jetty.bat start
Ensure Jetty starts successfully and the Java agent loads without errors.
Step3: Configure Attributes and Parameters
After configuring the application, you can provide the below details:
| Field | Description |
|---|---|
| Service Attributes(Tags) | Add key–value tags to your application for better filtering and organizing data in Explorer. Attribute keys must be in lowercase (for example, apm.env = prod). To add multiple Key-Value pairs you can click the add icon. |
| Add Custom Parameters | Allows you to define custom sampling or tagging parameters for advanced use cases. These optional parameters are passed to the agent (for example, version=4). |
Clicking the Apply Configuration button, the ingestion gets started.
Once the Application is Running, you need to verify the below points:
- Confirm that the service has been registered successfully.
- On the service registration screen, the Service Trace Collection Status should display "Running."
- The traces will start appearing in the APM Explorer screen.