1. 使用 GlassFish asadmin 添加 -javaagent JVM option。

    • Windows

      1
      2
      glassfish4\bin\asadmin.bat create-jvm-options
      '-javaagent:{agent 安装目录}\javaagent.jar'
    • Linux

      1
      2
      glassfish4\bin\asadmin create-jvm-options
      "-javaagent\:{agent 安装目录}/javaagent.jar"

      {agent 安装目录} 替换为真实的 Agent 解压目录

  2. 在 Glassfish 控制台添加

    Apptalking

    {agent 安装目录} 替换为真实的 Agent 解压目录

  3. 添加 Apptalking 的包到 Glassfish the boot delegation entry 配置中。

  • 在 GlassFish 3.x 到 3.1.2 版本, 使用配置文件 /glassfish/osgi/felix/conf/config.properties , 添加以下的配置。

    1
    org.osgi.framework.bootdelegation=com.apptalking.*
  • GlassFish 3.1.2以上版本, 使用配置文件 <glassfish_home>/glassfish/config/osgi.properties file, 添加配以下配置

    1
    com.apptalking.*

参考以下示例:

1
2
3
4
5
6
7
8
9
10
11
12
13
# Although Eclipselink imports these packages, in typical GlassFish installation,
# Oracle JDBC driver may not be available as a bundle, so we ask user to install it in
# java.ext.dirs and the bootdelegation helps there.
eclipselink.bootdelegation=oracle.sql, oracle.sql.*

# There is no need to use bootdelegation except for the following issues:
# 1. EclipseLink
# 4. NetBeans profiler packages exist in parent class loader (see issue #8612)
# 5. BTrace exists in bootclasspath.
org.osgi.framework.bootdelegation=${eclipselink.bootdelegation}, \
com.sun.btrace, com.sun.btrace.*, \
org.netbeans.lib.profiler, org.netbeans.lib.profiler.*,\
com.apptalking.*