Skip to main content

WebLogic

Adding JVM options

This guide explains how to add required JVM options to effectively use the Java monitoring agent in the WebLogic application server environment.

Check the OS and then complete the configuration.

{WebLogic_Path}/user_projects/domains/{User_Domain}/bin/startWebLogic.bat
rem ########## WHATAP START ############
set WHATAP_HOME=\path\to\whatap
for /f %%f in ('dir /b /on "%WHATAP_HOME%\whatap.agent-*.jar"') do set last=%%f
set WHATAP_JAR=%last%
set WHATAP_OPTS=-javaagent:%WHATAP_HOME%\%WHATAP_JAR%
if "x%JAVA_OPTIONS%"=="x" goto setWhatap
set JAVA_OPTIONS_TMP=%JAVA_OPTIONS:"=%
if not "x%JAVA_OPTIONS_TMP:whatap=%"=="x%JAVA_OPTIONS_TMP%" goto endWhatap
:setWhatap
set JAVA_OPTIONS=%JAVA_OPTIONS% %WHATAP_OPTS%
:endWhatap
rem ########## WHATAP END ############
Note

In case of Java 17 or later, add the following options for reflection.


--add-opens=java.base/java.lang=ALL-UNNAMED

Viewing the heap histogram

WhaTap's Java Monitoring provides the function to view the status of heap occupancy objects in the JVM memory (sizes for each object in heap memory). In APP > Instance performance analysis, select the Heap histogram tab.

Java versions 6 to 8 support basic functions without the JVM options. However, for some Java versions, the JVM options must be applied as follows:

  • Java 9 to Java 15

    -Djdk.attach.allowAttachSelf=true
    example
    java -javaagent:{WHATAP_HOME}/whatap.agent-X.Y.Z.jar -Djdk.attach.allowAttachSelf=true -jar {application.jar}
  • Java 16 or later

    -Djdk.attach.allowAttachSelf=true
    --add-opens=jdk.attach/sun.tools.attach=ALL-UNNAMED
    example
    java -javaagent:{WHATAP_HOME}/whatap.agent-X.Y.Z.jar -Djdk.attach.allowAttachSelf=true --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=jdk.attach/sun.tools.attach=ALL-UNNAMED -jar {application.jar}
Note

It does not support Java 5 or earlier and IBM Java.

Starting the monitoring

Once the application server is restarted after configuring all settings, the agents start collecting data. See the following.