Instrument Oracle WebLogic for an Application Running as a Windows Service

Some applications have a pre-compiled startup method that installs WebLogic as a Windows service.

To add the agent to the service:

  1. Open the script file that starts the application service, such as install_XXXX_Server_Start_Win_Service.cmd.
  2. Add the javaagent command before the line starting with set CMDLINE=%JAVA_VM%.., such as:
    set CLASSPATH=%MYSERVER_CLASSPATH%;%PRE_CLASSPATH%;%WEBLOGIC_CLASSPATH%;%POST_CLASSPATH%;%WLP_POST_CLASSPATH%
    set JAVA_VM=%JAVA_VM% %JAVA_DEBUG% %JAVA_PROFILE%
    set WLS_DISPLAY_MODE=Production
    @REM Enable the Java Agent
    set JAVA_OPTIONS=%JAVA_OPTIONS% -javaagent:"<drive>:\<agent_home>\javaagent.jar"
    @REM AppDynamics Agent END
    set CMDLINE=%JAVA_VM% %MEM_ARGS% -classpath %CLASSPATH% %JAVA_OPTIONS% weblogic.Server"
  3. Open a command prompt and run the following script to remove the existing Windows Service for your application:
    install_XXXXX_Server_Start_Win_Service.cmd  XXXXX_xxxxx_Production_Server  R
  4. Install the updated Windows Service for your application:
    install_XXXXX_Server_Start_Win_Service.cmd  XXXXX_xxxx_Production_Server  I
  5. From the WebLogic web console, stop your application.
  6. Start your application (which also starts WebLogic) from the Windows Services application, where the Windows service name = XXXXX_xxxx_Production_Server.
  7. Ensure that your application is working properly.
See Creating a Server-Specific Script in the Oracle documentation.