Installing Java Agent in WebSphere
Installing Java Agent in WebSphere in JIM Agent Installation & Configuration Guide.
Installing Java Agent in WebSphere#
Follow the below steps to install Java Agent in WebSphere.
Note:
For multiple Java agent environments: Ensure the purpose of the Java agent, and check if that conflicts with the functioning of the JIM agent before implementing.
There are two ways to add JVM arguments in WebSphere.
a. Configure using WebSphere UI.
b. Configure using the server.xml file.
Configure using WebSphere UI#
Follow the steps below to configure using the WebSphere UI.
1. WAS user ID and password are required to monitor KPIs.
2. Start the Server.
3. Open the Administrator console and enter the following URL:
http://localhost:9060/ibm/console/login.do
Or
To open the administrative console, navigate to Start>All Programs>IBM WebSphere.
4. Select the application server, navigate to Profiles, and then the administrative console.
Note: 9060 is the default port number for the admin console.
5. When the User ID is asked for, enter the username (given at the installation time). You can provide any name.
6. In the Welcome screen, click on Servers in the left pane. Select WebSphere Application servers, and in the right pane, click on the name of the server that you need to monitor.

The below screen appears.

- In Server Infrastructure, expand Java and Process Management and then select Process Definition.

- In the Additional Properties section, click Java Virtual Machine.

- Scroll down and locate the textbox for Generic JVM arguments.

i. Enter the following argument based on the below requirement, then save.
a) If you have passed the otel.resource.attributes in the agent-cache.properties file, enter the following argument.
-Dotel.javaagent.configuration-file=<JIM agent path>/config/agent-cache.properties -javaagent: <File Path>/jim-agent/heal-jim-opentelemetry-javaagent-<version>.jar
b) If you have commented out otel.resource.attributes in the agent-cache.properties file, enter the following argument.
-Dotel.javaagent.configuration-file=<JIM agent path>/config/agent-cache.properties -Dotel.resource.attributes=service.name=<service identifier>,agent.uid= <agent identifier>,instance.uid=<instance identifier> -javaagent:/opt/JIM/jim-agent/heal-jim-opentelemetry-javaagent-<version>.jar
Configure using server.xml file#
Follow the below steps to configure using the server.xml file:
1. Navigate to the following path:
/<path>/IBM/WebSphere/AppServer/profiles/Dmgr01/config/cells/<cell>/nodes/<node>/servers/dmgr/
2. Add the following commands to the server.xml file in the jvmEntries tag for the generic JVM arguments attribute.
a) If you have passed the otel.resource.attributes in the agent-cache.properties file, enter the following argument.
genericJvmArguments="-Dotel.javaagent.configuration-file=<JIM agent path>/config/agent-cache.properties -javaagent:<JIM agent path>/heal-jim-opentelemetry-javaagent-<version>.jar"
b) If you have commented out otel.resource.attributes in the agent-cache.properties file, enter the following argument.
genericJvmArguments="-Dotel.javaagent.configuration-file=<JIM agent path>/config/agent-cache.properties -Dotel.resource.attributes=service.name=<service identifier>,agent.uid= <agent identifier>,instance.uid=<instance identifier> -javaagent:<JIM agent path>/heal-jim-opentelemetry-javaagent-<version>.jar"
Note: All the parameters to the above command need to be in a single line. Do not press the 'Enter' key in between the parameters.
3. Adding permissions under server.policy.
In server.policy file for WebSphere, add the following.
grant codeBase "file:/<JIM agent path>/config/heal-jim-opentelemetry-javaagent-<version>.jar"
{
permission java.security.AllPermission;
};
Note: If you come across the error message below in jim logs:
Caused by: java.security.AccessControlException: Access denied ("java.lang.RuntimePermission" "getClassLoader")
Please refer to the Dealing with Java Security AccessControlException section in the Troubleshooting section.
4. Restart JVM.
Note: The above steps are applicable for Linux and SunOS WebSphere.
Installing Java Agent in WebLogic#
Installing Java Agent in WebLogic ensures the capture of necessary metrics and traces from the application.
In the WebLogic Server environment, applications run on managed servers and not administration servers.
For Information:
Administration Server:
- The administration server is central to the WebLogic Server domain and is responsible for managing the configuration of the domain.
- It is used for administrative tasks such as deploying applications, configuring resources, and monitoring the domain.
Managed Servers:
- These servers host the actual applications and resources.
- They are managed by the Administration Server but operate independently when running.
- In a production environment, the applications are usually deployed on managed servers to distribute the load and ensure high availability and scalability.
Hence, when the application is deployed in WebLogic, the managed servers are generally targeted more than the administration server.
Follow the steps below to install Java Agent in WebLogic.
There are two ways to add JVM arguments in WebLogic.
a. Configure using the setDomainEnv.sh file.
b. Configure using WebLogic UI.
Configure using setDomainEnv.sh file#
Note: The following steps are applicable for Linux and SunOS WebLogic too.
1. Modify Java options in the start-up file to enable the JIM agent. To do so, append the following lines as a single line just below the existing JAVA_OPTIONS code in the setDomainEnv.sh file of the WebLogic application server.
2. Add JAVA_OPTIONS as follows:
a) If you have passed the otel.resource.attributes in the agent-cache.properties file, enter the following argument.
JAVA_OPTIONS="$JAVA_OPTIONS -Dotel.javaagent.configuration-file=<JIM agent path>/config/agent-cache.properties -javaagent:<JIM agent path>/heal-jim-opentelemetry-javaagent-<version>.jar"
b) If you have commented out otel.resource.attributes in the agent-cache.properties file, enter the following argument.
JAVA_OPTIONS="$JAVA_OPTIONS -Dotel.javaagent.configuration-file=<JIM agent path>/config/agent-cache.properties -Dotel.resource.attributes=service.name=<service identifier>,agent.uid= <agent identifier>,instance.uid=<instance identifier> -javaagent:<JIM agent path>/heal-jim-opentelemetry-javaagent-<version>.jar"
Note: All the parameters to the above command need to be in a single line. Do not press the 'Enter' key in between the parameters.
3. Add the following line in weblogic.policy
grant codeBase "file:/<JIM agent path>/config/heal-jim-opentelemetry-javaagent-1.2.0.jar"
{permission java.security.AllPermission;
};
Note: If you come across the error message below in jim logs:
Caused by: java.security.AccessControlException: Access denied ("java.lang.RuntimePermission" "getClassLoader")
Please refer to the Dealing with Java Security AccessControlException section in the Troubleshooting section.
4. Restart the WebLogic server.
Note: If you use any script other than setDomainEnv.sh, then set the JAVA_HOME parameter values in the respective scripts.
Configure using WebLogic UI#
Note: The following steps are applicable for all the OS.
Follow the steps below to configure the Java agent in WebLogic UI:
1. Login to WebLogic UI.

- Navigate to Home > Servers and click on servers.

- Click on Admin Server (admin).

4. Click on Server Start.

In the Arguments section, enter the following argument based on the requirement below, and then Save.
a) If you have passed the otel.resource.attributes in the agent-cache.properties file, enter the following argument.
-Dotel.javaagent.configuration-file=<JIM agent path>/config/agent-cache.properties -javaagent: <File Path>/jim-agent/heal-jim-opentelemetry-javaagent-<version>.jar
b) If you have commented out otel.resource.attributes in the agent-cache.properties file, enter the following argument.
-Dotel.javaagent.configuration-file=<JIM agent path>/config/agent-cache.properties -Dotel.resource.attributes=service.name=<service identifier>,agent.uid= <agent identifier>,instance.uid=<instance identifier> -javaagent:/opt/JIM/jim-agent/heal-jim-opentelemetry-javaagent-<version>.jar