Skip to main content

Spring Boot

Check the method how to add JVM options in the application server environment using Spring Boot.

Adding JVM options

  • In case of Java 17 or later, the application can be started by adding JVM options related to the reflection.

    # Only support Java 17 or later
    java -javaagent:{WHATAP_HOME}/whatap.agent-X.Y.Z.jar -Dwhatap.oname={Agent_Name} --add-opens=java.base/java.lang=ALL-UNNAMED -jar {application.jar}
  • For the JVM options in the startup script, add -javaagent.

    java -javaagent:{WHATAP_HOME}/whatap.agent-X.Y.Z.jar -jar {application.jar}

Add the JVM options and then proceed with the appropriate agent configuration according to the versions of Spring Boot and agents.

Spring Boot 3

Spring Boot version 3.0.0 or later

  • Java agent v2.2.9 or later (whatap.agent-2.2.9.jar)

    whatap.conf
    weaving=spring-boot-3.0
  • Java agent v2.2.5 or later (whatap.agent-2.2.5.jar)

    whatap.conf
    weaving=spring-boot-3.0,tomcat10
  • Java agent v2.2.4 or earlier (whatap.agent-2.2.4.jar)

    • jakarta.servlet.http.HttpServlet tracing (synchronization method)

      whatap.conf
      weaving=tomcat10
    • WebClient tracing (Asynchronization method)

      whatap.conf
      weaving=webflux-6.0

Spring Boot 2

Spring Boot version 2.7.0 or later

  • Java agent v2.2.9 or later (whatap.agent-2.2.9.jar)

    whatap.conf
    weaving=spring-boot-2.7
  • Java agent v2.2.5 or later (whatap.agent-2.2.5.jar)

    whatap.conf
    weaving=spring-boot-2.7,tomcat9
  • Java agent v2.2.4 or earlier (whatap.agent-2.2.4.jar)

    WebClient tracing (Asynchronization method)

    whatap.conf
    weaving=webflux-5.3

Spring Boot version 2.5.0 or later

  • Java agent v2.2.9 or later (whatap.agent-2.2.9.jar)

    whatap.conf
    weaving=spring-boot-2.5
  • Java agent v2.2.5 or later (whatap.agent-2.2.5.jar)

    whatap.conf
    weaving=spring-boot-2.5,tomcat9
  • Java agent v2.2.4 or earlier (whatap.agent-2.2.4.jar)

    WebClient tracing (Asynchronization method)

    whatap.conf
    weaving=webflux-5.3

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.

Next steps

  • Open source tracing

    Depending on the framework or open source library used in applications, you may need to add agent options. For example, when using spring-boot-3.x, feign-client-11, or okhttp3-4.4 with a framework or open source, set the options as follows:

    whatap.conf
    weaving=spring-boot-3.0,feign-11,okhttp3-4.4

    For information on how to configure the framework or open source library that suits your application environment, see the following.

  • Checking the installation

    If you have created a project, installed an agent, and applied all JVM options, see the checklist in the following.

  • Installation troubleshooting

    It provides various problems that may occur when installing the agent and specific instructions for resolving them. It provides solutions against various situations, including firewall configuration, SpringBoot and Tomcat JMX configuration, and server configuration using the OSGI framework. For more information, see the following.

  • Agent setting

    It provides various features for monitoring by applying some options to the agent configuration file (whatap.conf). It includes basic configuration, configuration for server connection and data transfer, how to manage the configuration files for multiple application servers, and transaction tracing, and more. For more information, see the following.

  • Starting the monitoring

    After all settings are made, restart the application server. The agent starts collecting data. First, check whether the monitoring data has been collected in Application Dashboard. For more information about Application Dashboard, see the following.