Oracle GlassFish is an OSGi-based application container. This page describes how to set configure class bootloader settings and load the Java Agent in the runtime JVM.  

Instrument Oracle GlassFish

  1. Add the location of the Java Agent JAR file as a -javaagent JVM option in the GlassFish domain. You can add the agent using the asadmin tool as follows:

    For Windows:

    glassfish4\bin\asadmin.bat create-jvm-options '-javaagent:<Drive_letter>:<agent_home>\javaagent.jar' 
    
    CODE

    For Linux:

    glassfish4\bin\asadmin create-jvm-options "-javaagent\:/home/appduser/javaagent/javaagent.jar"
    CODE

    Ensure you escape the colon character on Linux. 

  2. Configure the boot delegation entry for the AppDynamics package: 

    • In GlassFish 3.x to 3.1.2, open the config.properties file located at <glassfish_home>/glassfish/osgi/felix/conf and add the following package prefix to the config.properties file: 
      org.osgi.framework.bootdelegation=com.singularity.* 

    • In GlassFish => 3.1.2, in the boot delegation list in the <glassfish_home>/glassfish/config/osgi.properties file, add com.singularity.* 
      For example:
      Boot Delegation Entry 

  3. Restart the application server.

To verify the configuration, review the domain.xml file located at <glassfish_home>\domains\<domain_name>\config. The domain.xml file should have an entry for the -javaagent option. 

Instrument Oracle GlassFish with the Admin Console

  1. Start the GlassFish application server.
  2. Navigate to the GlassFish admin console (http://localhost:4848/).
  3. Navigate to Configurations > server-config > JVM Settings.
  4. Click the JVM Options tab and click Add JVM Option to add a blank field in the list.
  5. Add the following path of the javaagent.jar file in the blank field:

    -javaagent:/home/appduser/javaagent/javaagent.jar
    CODE
  6. Click Save on the right top corner.
  7. Restart the GlassFishapplication server and <glassfish_home>\domains\<domain_name>\config
    The domain.xml file must contain an entry for the -javaagent option.

JVM Settings

About Glassfish AMX Support

AppDynamics supports Glassfish AMX MBeans.

Set the boot-amx node property to enable AMX MBeans. See boot-amx.

You will see the AMX domain in the MBean Browser in the JMX tab of the node dashboard.