Install APM Insight Java Agent in Glassfish 3.x & above


APM Insight Java Agent can be installed in Glassfish Server through Admin Console as follows:

Example: -javaagent:D:/apminsight/apminsight-javaagent.jar

Admin Console

Download latest the APM Insight Java agent zip file (apminsight-javaagent.zip) here.

For standalone setup:

  • Extract the zip file to a new directory outside the glassfish server directory
  • Open the apminsight.conf file in any text editor and include the following keys:
    license.key=[LICENSE KEY]
    apm.host=http://[HOST]:[PORT]

    Example:

    license.key=APMI_74447444b666d7ab5174cc3021a9b68dd4b3364d50f99c2969360810313e8fac
    apm.host=http://apm-prod-server:9090
    To learn more about the configurations, visit our Configuration Guide page.
  • Open the administrative console of your glassfish server. Select Configurations and select the configuration used by the server
  • Select JVM Settings > Add JVM Option, then add the following parameter
    -javaagent:<agent_directory_full_path>/apminsight-javaagent.jar
  • Open the osgi configuration file, which can be found in either of the paths
    /glassfish/config/osgi.properties
    or/glassfish/osgi/felix/conf/config.properties

    Find the key org.osgi.framework.bootdelegation and append com.manageengine.* to the existing values.
  • Click Save button and start the glassfish server.

For cluster setup:

  • Extract the zip file to a new directory outside the Glassfish server directory
  • Copy the apminsight-javaagent.jar file from above directory to <GLASSFISH_HOME>\glassfish\domains\<domain>\lib\ext directory of the domain server
  • Create a new directory named "apminsight" under <GLASSFISH_HOME>\glassfish\nodes\<node>\<instance> in instance server and copy only the agent conf files from directory created in step 1 to this directory.
  • Open the apminsight.conf file in any text editor and include the following keys:
    license.key=[LICENSE KEY]
    apm.host=http://[HOST]:[PORT]

    Example:

    license.key=APMI_74447444b666d7ab5174cc3021a9b68dd4b3364d50f99c2969360810313e8fac
    apm.host=http://apm-prod-server:9090
    To learn more about the configurations, visit our Configuration Guide page.
  • Repeat the above two steps for every instance you like to add the java agent
  • Open the administrative console of your glassfish server. Select Configurations and select the configuration used by the cluster.
  • Select JVM Settings > Add JVM Option, then add the following parameters as such
    -javaagent:${com.sun.aas.instanceRoot}/lib/ext/apminsight-javaagent.jar
    -Dapminsight.home=${com.sun.aas.instanceRoot}/apminsight
  • Click Save button and start the glassfish cluster.
Note:
  • You can also configure a secure APM URL. Ensure that the connection is stable and free from certificate-related issues.
    Example: https://apm-prod-server:8443
  • For an Applications Manager failover setup, you can specify multiple hosts in a comma-separated format (supported from Java Agent v6.8), as shown below:
    apm.host=http://apm-prod-server-A:9090, http://apm-prod-server-B:9090