AppDynamics Application Intelligence Platform

3.8.x Documentation

PDFs

Videos

Release Notes

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.

To add the javaagent command in a Windows environment

  1. Open the server run.bat file, located at <jboss_version_install_directory>\bin.
  2. 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"

    (warning) 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.

  3. Sample JBoss 4.x run.bat file
    1. Sample JBoss 4.x run.bat file:
    2.  Sample JBoss 5.x run.bat file

  4.  Restart the application server. The application server must be restarted for the changes to take effect.

To add the javaagent command in a Linux environment for JBoss 5.x

  1. Open the server run.sh file, located at <jboss_version_install_dir>/bin.
  2. Add the following javaagent argument to the server start script.

    export JAVA_OPTS="$JAVA_OPTS -javaagent:/<agent_home>/javaagent.jar"
    1. Sample JBoss 5.x run.sh file

    2. (warning) 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>
      
  3. Restart the application server. You must restart the application server for the changes to take effect.

To add the javaagent command in a Linux environment for JBoss AS 6.x

Use the following instructions for JBoss 6.x unless your version matches one for which more specific instructions exist on this page: 

  1. Open the server run.sh file, located at <jboss_version_install_dir>/bin.
  2. 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"
  3. Add the following javaagent argument to the server start script.

    export JAVA_OPTS="$JAVA_OPTS -javaagent:/agent_install_dir/javaagent.jar"
  4. Restart the application server. You must restart the application server for the changes to take effect.

To add the javaagent command in a Linux environment for JBoss EAP 6.1.1 and JBoss AS 7.0.x (standalone)

  1. Open the standalone.sh file.

  2. 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.

  3. Restart the application server. You must restart the application server for the changes to take effect.

  4. Integrate error detection with the jboss log manager logging implementation using a custom logger definition as described in Configuring Error Detection Using Custom Loggers.

To add the javaagent command in a Linux environment for JBoss 7.1.1

  1. Open the standalone.sh file
  2. Search for the following line in standalone.sh.

    # Setup the JVM
  3. 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.

  4. Open standalone.conf and search for the following.

    # Uncomment the following line to prevent manipulation of JVM options
  5. 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
  6. Restart the application server. You must restart the application server for the changes to take effect.

To add the javaagent command in a Linux environment for JBoss EAP 6.0.1, JBoss EAP 6.2.0, JBoss AS 7.x

  1. Open the standalone.conf file.
  2. Search for the following line in standalone.conf.

    JBOSS_MODULES_SYSTEM_PKGS="org.jboss.byteman"
  3. 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"
  4. 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.

  5. 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:

  6. Restart the application server. 

To add the javaagent command in a Linux Environment for JBoss EAP 6.1.0

  1. Open the bin/standalone.sh file and find the location where JAVA_OPTS is defined.

  2. Add the following option to the existing JAVA_OPTS arguments:  

    -javaagent:/path/to/jboss-eap-6.1.0_appagent/javaagent.jar 
  3. 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.

  4. Restart the application server to have the changes take effect.

  5. Integrate error detection with the JBoss log manager logging implementation using a custom logger definition as described in Configuring Error Detection Using Custom Loggers.

To add the javaagent command in a Windows environment for JBoss EAP 6.0.1, JBoss EAP 6.2.0, JBoss AS 7.x

  1. Open the bin\standalone.conf file.
  2. 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"
  3. Save the file.
  4. Open the standalone.bat file.
  5. 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" 
  6. Save the file.

  7. Restart the application server. The application server must be restarted for the changes to take effect.

To add the javaagent command to RHEL JBoss EAP 6.x, JBoss AS 7.0.x, Wildfly 8 (Domain Mode)

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.

  • If all the server instances in the server group are part of the same business application, then configure -Dappdynamics.agent.applicationName in domain.xml; otherwise, configure the application name in the host.xml file for each specific server.
  • If all the server instances in the server group are part of the same tier then configure -Dappdynamics.agent.tierName in domain.xml, otherwise configure the tier name in host.xml for each specific server.

-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.

Revise the Domain.xml file

  1. Locate and edit domain.xml, usually located under $JBOSS_HOME/domain/configuration/.
  2. 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.

  3. Under the server group name where you want to enable your AppDynamics agents, add the JVM options using the appropriate values for your agent location, JBoss application name, and tier name.
<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>

Revise the Host.xml file

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>

To add the agent to JBoss 7.2 (standalone)

  1. 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"
  2. 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
  3. Restart the application server. The application server must be restarted for the changes to take effect.

 

Fix Linkage Error

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.