setDomainEnv, and managed servers through the Admin console. Standard steps (download, apminsight.conf) are in the WebLogic installation guide.| Server | Usually started by | Reads agent argument from |
|---|---|---|
| AdminServer | startWebLogic (or its own Windows service) | setDomainEnv / JAVA_OPTIONS — not the console |
| Managed servers | Node Manager — Admin console Control → Start or WLST start() | Console: Server Start → Arguments |
The console cannot restart the AdminServer it runs on, and its Server Start arguments are not read by startWebLogic. So the AdminServer needs the argument in setDomainEnv.
Open <DOMAIN_HOME>\bin\setDomainEnv.cmd (Linux: setDomainEnv.sh). Take a backup, then add the block below just before the line containing SET THE CLASSPATH:
@REM ===== APM Insight agent - AdminServer only =====
if "%SERVER_NAME%"=="AdminServer" set JAVA_OPTIONS=%JAVA_OPTIONS% -DUseSunHttpHandler=true -javaagent:<agent_dir>\apminsight-javaagent.jar -Dapminsight.application.name=AdminServer -Dapminsight.agent.server.port=<admin_port>
@REM =================================================
Linux
# ===== APM Insight agent - AdminServer only =====
if [ "$SERVER_NAME" = "AdminServer" ]; then
JAVA_OPTIONS="$JAVA_OPTIONS -DUseSunHttpHandler=true -javaagent:<agent_dir>/apminsight-javaagent.jar -Dapminsight.application.name=AdminServer -Dapminsight.agent.server.port=<admin_port>"
export JAVA_OPTIONS
fi
# =================================================
if ( ... ) block can break if JAVA_OPTIONS contains brackets.AdminServer if your AdminServer has a different name (the value of -Dweblogic.Name).SERVER_NAME check is important — every server sources setDomainEnv, so without it the managed servers would also get the AdminServer's agent settings.Restart the AdminServer: stop it (stopWebLogic.cmd or console Control → Shutdown), then start it with startWebLogic.cmd.
installSvc.cmd, it stores the full Java command line in the registry (HKLM\SYSTEM\CurrentControlSet\Services\<service>\Parameters → CmdLine) and does not read setDomainEnv.cmd again at start. After the change, either re-create the service (uninstallSvc.cmd → installSvc.cmd) or add the agent argument to CmdLine, then restart the service. Check with sc qc "<service_name>" — beasvc.exe / wlsvc.exe in the path means it is this type.-DUseSunHttpHandler=true -javaagent:<agent_dir>/apminsight-javaagent.jar -Dapminsight.application.name=<server_name> -Dapminsight.agent.server.port=<server_port>
cd <ORACLE_HOME>\oracle_common\common\bin
wlst.cmd
connect('<admin_user>','<password>','http://<admin_host>:<admin_port>')
shutdown('<server_name>', force='true')
start('<server_name>')
exit()
startManagedWebLogic.cmd when the argument is only in the console — the script does not read console arguments, and the server comes up without the agent.-javaagent:# Windows (PowerShell)
Get-CimInstance Win32_Process -Filter "name='java.exe'" | Select-Object CommandLine
# Linux
ps -ef | grep weblogic.Name
<server_name>_<port> is created per server, and APM_Java_Instances has one entry per server.setDomainEnv and a Server Start screenshot of each managed server