AppDynamics Application Intelligence Platform
3.8.x Documentation
The AppDynamics Java App Server Agent bootstraps using the javaagent command line option. Add this option to your JBoss server run.sh or run.bat file.
Add the following javaagent argument at the beginning of your app server start script.
set JAVA_OPTS=%JAVA_OPTS% -javaagent:"<drive>:\<agent_home>\javaagent.jar"
If you are a Self-Service Trial user, add the App Agent for Java javaagent argument to your JVM start script where <my-app-jvm1> is the name you use for the application running on that JVM.
-javaagent:"<drive>:\<agent_home>\javaagent.jar=uniqueID=<my-app-jvm1>"
The javaagent argument references the full path of the App Server Agent installation directory, including the drive. For details see the screen captures.
Add the following javaagent argument to the server start script.
export JAVA_OPTS="$JAVA_OPTS -javaagent:/<agent_home>/javaagent.jar"
Sample JBoss 5.x run.sh file
If you are a Self-Service Trial user, add the App Agent for Java javaagent argument to your JVM start script where <my-app-jvm1> is the name you use for the application running on that JVM.
-javaagent:<agent_home>/javaagent.jar=uniqueID=<my-app-jvm1>
Use the following instructions for JBoss 6.x unless your version matches one for which more specific instructions exist on this page:
Add the following Java environment variables to the server start script.
JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.jboss.logmanager.LogManager" JAVA_ARGS="$JAVA_OPTS -Dorg.jboss.logging.Logger.pluginClass=org.jboss.logging.logmanager.LoggerPluginImpl" JBOSS_CLASSPATH=<path>"jboss-logmanager.jar"
Add the following javaagent argument to the server start script.
export JAVA_OPTS="$JAVA_OPTS -javaagent:/agent_install_dir/javaagent.jar"
Open the standalone.sh file.
Add the following and save the file:
JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Xbootclasspath/p:/<path/to/jboss-eap-6.1.1>/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-1.4.3.Final-redhat-1.jar:/<path/to/jboss-eap-6.1.1>/modules/system/layers/base/org/jboss/log4j/logmanager/main/log4j-jboss-logmanager-1.0.2.Final-redhat-1.jar"JAVA_OPTS="$JAVA_OPTS -javaagent:/<path/to/appdynamics>/javaagent.jar" JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=org.jboss.byteman,org.jboss.logmanager,com.appdynamics,com.appdynamics.,com.singularity,com.singularity."
Note: Substitute <path/to/jboss-eap-6.1.1> and <path/to/appdynamics> with the correct respective paths for your installation.
Restart the application server. You must restart the application server for the changes to take effect.
Search for the following line in standalone.sh.
# Setup the JVM
Add the following above that section and save the file.
export JAVA_OPTS="$JAVA_OPTS -javaagent:<agent-path>/javaagent.jar -Dorg.jboss.boot.log.file=$JBOSS_HOME/standalone/log/boot.log -Djava.util.logging.manager=org.jboss.logmanager.LogManager" export JAVA_OPTS="$JAVA_OPTS -Xbootclasspath/p:$JBOSS_HOME/modules/org/apache/log4j/main/log4j-1.2.16.jar:$JBOSS_HOME/modules/org/jboss/logmanager/log4j/main/jboss-logmanager-log4j-1.0.0.GA.jar:$JBOSS_HOME/modules/org/jboss/logmanager/main/jboss-logmanager-1.2.2.GA.jar -Dlogging.configuration=file:$JBOSS_HOME/standalone/configuration/logging.properties" #export JAVA_OPTS="$JAVA_OPTS -Xbootclasspath/p:$JBOSS_HOME/modules/org/jboss/logmanager/main/jboss-logmanager-1.2.2.GA.jar -Dlogging.configuration=file:$JBOSS_HOME/standalone/configuration/logging.properties"
Note: Substitute <agent-path> with the correct path for your installation.
Open standalone.conf and search for the following.
# Uncomment the following line to prevent manipulation of JVM options
Add the following above that section and save the file.
if [ "x$JBOSS_MODULES_SYSTEM_PKGS" = "x" ]; then JBOSS_MODULES_SYSTEM_PKGS="org.jboss.byteman,com.appdynamics,com.appdynamics.,com.singularity,com.singularity.,org.jboss.logmanager" # JBOSS_MODULES_SYSTEM_PKGS="org.jboss.byteman" fi
Search for the following line in standalone.conf.
JBOSS_MODULES_SYSTEM_PKGS="org.jboss.byteman"
Add the com.singularity and org.jboss.logmanager packages to that line as follows:
JBOSS_MODULES_SYSTEM_PKGS="org.jboss.byteman,com.singularity,org.jboss.logmanager"
Add the following to the end of the standalone.conf file in the JAVA_OPTS section.
-Djava.util.logging.manager=org.jboss.logmanager.LogManager -Xbootclasspath/p:<JBOSS-DIR>/modules/org/jboss/logmanager/main/jboss-logmanager-1.2.2.GA.jar :<JBOSS-DIR>/modules/org/jboss/logmanager/log4j/main/jboss-logmanager-log4j-1.0.0.GA.jar :<JBOSS-DIR>/modules/org/jboss/logmanager/log4j/main/log4j-1.2.16.jar
Note: The path for the necessary JAR files may differ for different versions. Provide the correct path of these JAR files for your version. If any of the packages are not available with the JBoss ZIP, download the missing package and add it to the path.
In the standalone.sh file, add the following javaagent argument.
export JAVA_OPTS="$JAVA_OPTS -javaagent:/agent_install_dir/javaagent.jar"
above the following section of standalone.sh
... while true;do if [ "x$LAUNCH_JBOSS_IN_BACKGROUND" = "X" ]; then # Execute the JVM in the foreground eval \"$JAVA\" -D\"[Standalone]\"$JAVA_OPTS \ \"-Dorg.jboss.boot.log.file=$JBOSS_LOG_DIR/boot.log\" \ \"-Dlogging.configuration=file:$JBOSS_CONFIG_DIR/logging.properties\" \ -jar \"$JBOSS_HOME/jboss-modules.jar\" \
The revised section of your startup script file should look similar to the following image:
Open the bin/standalone.sh file and find the location where JAVA_OPTS is defined.
Add the following option to the existing JAVA_OPTS arguments:
-javaagent:/path/to/jboss-eap-6.1.0_appagent/javaagent.jar
Add the com.singularity and org.jboss.logmanager to the -Djboss.modules.system.pkgs argument in JAVA_OPTS. The JAVA_OPTS section should look something like this:
JAVA_OPTS="$JAVA_OPTS -javaagent:/path/to/jboss-eap-6.1.0_appagent/javaagent.jar -Djboss.modules.system.pkgs=$JBOSS_MODULES_SYSTEM_PKGS,com.singularity,org.jboss.logmanager -Djava.awt.headless=true"
Note: Substitute <path/to/jboss-eap-6.1.0_appagent> with the path for your installation.
Restart the application server to have the changes take effect.
Search for the line JBOSS_MODULES_SYSTEM_PKGS="org.jboss.byteman" and add the com.singularity and org.jboss.logmanager packages to that line as follows:
JBOSS_MODULES_SYSTEM_PKGS="org.jboss.byteman,com.singularity,org.jboss.logmanager"
Add the following javaagent argument to the standalone.bat file.
:RESTART "%JAVA%" -javaagent:<AGENT-DIR>javaagent.jar %JAVA_OPTS% "-Dorg.jboss.boot.log.file=%JBOSS_HOME%\standalone\log\boot.log" "-Dlogging.configuration=file:%JBOSS_HOME%/standalone/configuration/logging.properties" -jar "%JBOSS_HOME%\jboss-modules.jar"
Save the file.
Restart the application server. The application server must be restarted for the changes to take effect.
You must add a system property to allow the com.singularity classes in the AppDynamics agent to be found from any class loader.
Add the jvm options specifying the location of the agent jar file, the application name, and the tier name.
-Dappdynamics.agent.applicationName
tells the AppDynamics agents the name of the Business Application to be used to connect to the AppDynamics Controller.
-Dappdynamics.agent.tierName
tells the AppDynamics agents the name of the tier to use to connect to the AppDynamics Controller.
Revise the JBoss domain.xml and host.xml files as indicated in the following sections and then restart the application server.
Add the following system property, <property name="jboss.modules.system.pkgs" value="com.singularity"/>
in the <system-properties>
element.
<system-properties> <!-- IPv4 is not required, but setting this helps avoid unintended use of IPv6 --> <property name="java.net.preferIPv4Stack" value="true"/> <property name="jboss.modules.system.pkgs" value="com.singularity"/> </system-properties>
This property tells the JBoss modules to allow the com.singularity classes in the AppDynamics App Agent for Java to be found from any class loader. This is required for the agent to run.
<server-group name="main-server-group" profile="full"> <jvm name="default"> <heap size="1303m" max-size="1303m"/> <permgen max-size="256m"/> <jvm-options> <option value="-javaagent:<agent_install_dir>/javaagent.jar"/> <option value="-Dappdynamics.agent.applicationName=JBOSS-EAP-APP"/> <option value="-Dappdynamics.agent.tierName=JBOSS-EAP-TIER"/> </jvm-options> </jvm> <socket-binding-group ref="full-sockets"/> </server-group>
Add the -Dappdynamics.agent.nodeName jvm option in the host.xml file (usually located under $JBOSS_HOME/domain/configuration/). This option tells the AppDynamics agent the node name to use to connect to the AppDynamics Controller. Use the appropriate values for your node names.
For example:
<servers> <server name="server-one" group="main-server-group"> <!-- Remote JPDA debugging for a specific server <option value="-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n"/> --> <jvm name="default"> <jvm-options> <option value="-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n"/> <option value="-Dappdynamics.agent.nodeName=JBOSS-EAP-NODE-1"/> </jvm-options> </jvm> </server> <server name="server-two" group="main-server-group" auto-start="true"> <!-- server-two avoids port conflicts by incrementing the ports in the default socket-group declared in the server-group --> <socket-bindings port-offset="150"/> <jvm name="default"> <jvm-options> <option value="-Dappdynamics.agent.nodeName=JBOSS-EAP-NODE-2"/> </jvm-options> </jvm> </server> <server name="server-three" group="other-server-group" auto-start="false"> <!-- server-three avoids port conflicts by incrementing the ports in the default socket-group declared in the server-group --> <socket-bindings port-offset="250"/> </server> </servers>
Add the following to the standalone.sh file.
AD_AGENT_HOME="/Users/jack.ginnever/Downloads/AppD-Downloads/AppServerAgent/3.8.1.0/AppServerAgent" AD_CONT_HOST="localhost" AD_CONT_POST="8090" AD_APPL_NAME="JBossAS" AD_APPL_TIER="standalone" AD_APPL_NODE="jboss_node" AD_OPTS=" -javaagent:$AD_AGENT_HOME/javaagent.jar \ -Dappdynamics.controller.hostName=$AD_CONT_HOST \ -Dappdynamics.controller.port=$AD_CONT_POST \ -Dappdynamics.agent.applicationName=$AD_APPL_NAME \ -Dappdynamics.agent.tierName=$AD_APPL_TIER \ -Dappdynamics.agent.nodeName=$AD_APPL_NODE " # Fix up the Loggers and Bootclasspath AD_OPTS="$AD_OPTS -Dorg.jboss.boot.log.file=$JBOSS_HOME/standalone/log/boot.log \ -Djava.util.logging.manager=org.jboss.logmanager.LogManager" AD_OPTS="$AD_OPTS -Xbootclasspath/p:$JBOSS_HOME/modules/org/apache/log4j/main/log4j-1.2.16.jar:$JBOSS_HOME/modules/org/jboss/log4j/logmanager/main/log4j-jboss-logmanager-1.0.1.Final.jar:$JBOSS_HOME/modules/org/jboss/logmanager/main/jboss-logmanager-1.4.0.Final.jar -Dlogging.configuration=file:$JBOSS_HOME/standalone/configuration/logging.properties" JAVA_OPTS="$AD_OPTS $JAVA_OPTS"
Add the following to the standalone.conf file and save it.
# --> Commented out original mod to JBOSS_MODULES_SYSTEM_PKGS # #if [ "x$JBOSS_MODULES_SYSTEM_PKGS" = "x" ]; then # JBOSS_MODULES_SYSTEM_PKGS="org.jboss.byteman" #fi # # --> Replaced with following mod to JBOSS_MODULES_SYSTEM_PKGS # if [ "x$JBOSS_MODULES_SYSTEM_PKGS" = "x" ]; then JBOSS_MODULES_SYSTEM_PKGS="org.jboss.byteman,com.appdynamics,com.appdynamics.,com.singularity,com.singularity." fi
Restart the application server. The application server must be restarted for the changes to take effect.
If you see this error:
Caused by: java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method "com.microsoft.sqlserver.jdbc.SQLServerXAConnection.getXAResource()Ljavax/transaction/xa/XAResource;" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, com/microsoft/sqlserver/jdbc/SQLServerXAConnection, and the class loader (instance of <bootloader>) for interface javax/sql/XAConnection have different Class objects for the type javax/transaction/xa/XAResource used in the signature
Add the following JVM option to the start-up script and restart the server:
-Dappdynamics.bciengine.class.lookahead=!*
The error indicates a race condition while loading classes and this flag controls the class loading hierarchy thus overcoming the class loading problems.