Adding the APM Java Agent to your WebLogic Server

There are three ways to add the APM Java agent to your WebLogic server.
  • Modifying startWebLogic.sh: This will deploy APM Agent on the domain’s WebLogic administration server and on all the managed servers.

  • Modifying startManagedWebLogic.sh: This will deploy APM Agent on the managed servers on the domain.

  • Using the administration console: If you are using Node Manager, use the WebLogic Server administration console to configure the servers you want to add the APM Agent to.

To deploy APM Agent on the domain’s WebLogic administration server and on all the managed servers by modifying the startWebLogic.sh script of your WebLogic Server domain:
  1. Make a copy of your startWebLogic.sh file:
    % cd $DOMAIN_HOME/bin
    % cp startWebLogic.sh startWebLogic.sh.orig
  2. Using a text editor, edit the original script to add the -javaagent option to the set of Java options:
    1. Add the following line after the setDomainEnv.sh call:
      JAVA_OPTIONS="${JAVA_OPTIONS} -javaagent:${DOMAIN_HOME}/apmagent/lib/system/ApmAgentInstrumentation.jar"
      Here is an example of the startWebLogic.sh file with the above -javaagent option added.
      DOMAIN_HOME=<path to your domain home>
      . ${DOMAIN_HOME}/bin/setDomainEnv.sh $*
      JAVA_OPTIONS="${JAVA_OPTIONS} -javaagent:${DOMAIN_HOME}/apmagent/lib/system/ApmAgentInstrumentation.jar"
      JAVA_OPTIONS="${JAVA_OPTIONS} -Djava.util.logging.manager=oracle.core.ojdl.logging.ODLLogManager"
      SAVE_JAVA_OPTIONS="${JAVA_OPTIONS}"
      SAVE_CLASSPATH="${CLASSPATH}"
  3. Stop and restart the WebLogic Server:
    % cd $DOMAIN_HOME/bin                      
    % ./stopWebLogic.sh                        
    % cd ..                                    
    % nohup ./startWebLogic.sh >& startup.log &

    You can check the entries present in the $DOMAIN_HOME/startup.log file to verify that the WebLogic Server has started.

    Note:

    Notice that the $DOMAIN_HOME version of the startWebLogic.sh is used, even though you edited the $DOMAIN_HOME/bin version. Invoking the startWebLogic.sh script from one level higher (from $DOMAIN_HOME) invokes the script from a lower level (from $DOMAIN_HOME/bin).

    However, the stopWebLogic.sh script will be called from the $DOMAIN_HOME/bin directory.

  4. If you have any managed WebLogic application servers, stop and restart them.
To deploy APM Agent on the managed servers by modifying the startManagedWebLogic.sh script of your WebLogic Server domain:

You can choose to monitor only the managed servers through Application Performance Monitoring, without monitoring the administration server. In such a case, make the modifications listed above in the bin/startManagedWebLogic.sh file instead of bin/startWebLogic.sh file.

  1. Make a copy of your startManagedWebLogic.sh file:

    % cd $DOMAIN_HOME/bin
    % cp startManagedWebLogic.sh startManagedWebLogic.sh.orig
  2. Using a text editor, edit the file startManagedWebLogic.sh, and locate the DOMAIN_HOME definition in the file:

    DOMAIN_HOME=<path_to_domain_home>
  3. Add the below JAVA_OPTIONS line right after the DOMAIN_HOME definition:

    DOMAIN_HOME=<path to your domain home>
    JAVA_OPTIONS="${JAVA_OPTIONS} -javaagent:${DOMAIN_HOME}/apmagent/lib/system/ApmAgentInstrumentation.jar"
  4. Stop and restart the WebLogic Server.

To deploy APM Agent using the administration console:

If your servers are started using the Node Manager, specify the -javaagent parameter in the management console: Environment/Servers/Configuration/Server Start, in the Argument field.