Java agent for Jboss server

Downloading the agent

  1. Download the agent tar file from the following link.
curl --header "PRIVATE-TOKEN: $TOKEN " --output agent.zip "https://artifacts-observability.sixthsense.rakuten.com/api/v4/projects/4/packages/generic/sixthsense/{{AGENT_VERSION}}/agent.zip
  1. Copy the tar to the $JBOSS_HOME folder and untar the file.

Configuring the agent

Update the following parameters in the agent.config file in the agent.

agent.service_name= APPLICATION_NAME
agent.force_tls= true
collector.backend_service = URL
agent.authentication = TOKEN_FROM_UI

Configuring the JBoss server

Unix Environment

Add the following entries in the standalone.conf file of the JBoss server.

JBOSS_MODULES_SYSTEM_PKGS="org.jboss.byteman,org.jboss.logmanager,org.apache.skywalking"

The path to the standalone.conf file is JBOSS_HOME/bin/.

JAVA_OPTS="$JAVA_OPTS -javaagent:$JBOSS_HOME/agent/sixthsense-agent.jar"
JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
JAVA_OPTS="$JAVA_OPTS -Xbootclasspath/a:$JBOSS_HOME/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-2.1.14.Final-redhat-00001.jar"
JAVA_OPTS="$JAVA_OPTS -Xbootclasspath/a:$JBOSS_HOME/modules/system/layers/base/org/wildfly/common/main/wildfly-common-1.5.1.Final-redhat-00001.jar"

Windows Environment

Add the following entries in the standalone.conf.bat file of the JBoss server.The path to the standalone.conf.bat file is JBOSS_HOME/bin/.

set JBOSS_MODULES_SYSTEM_PKGS="org.jboss.byteman,org.jboss.logmanager,org.apache.skywalking"
set "JAVA_OPTS=%JAVA_OPTS% -javaagent:%JBOSS_HOME%/sixthsense-agent/sixthsense-agent.jar"
set "JAVA_OPTS=%JAVA_OPTS% -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
set "JAVA_OPTS=%JAVA_OPTS% -Djboss.modules.system.pkgs=org.jboss.byteman,org.jboss.logmanager,org.apache.skywalking -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dorg.jboss.logging.Logger.pluginClass=org.jboss.logging.logmanager.LoggerPluginImpl"
set "JAVA_OPTS=%JAVA_OPTS% -Dsun.util.logging.disableCallerCheck=true"
set "JAVA_OPTS=%JAVA_OPTS% -Xbootclasspath/a:$JBOSS_HOME/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-2.1.14.Final-redhat-00001.jar"
set "JAVA_OPTS=%JAVA_OPTS% -Xbootclasspath/a:$JBOSS_HOME/modules/system/layers/base/org/wildfly/common/main/wildfly-common-1.5.1.Final-redhat-00001.jar"

Debug Issue

If the Jboss or WildFly server failed to start with following error:

WARNING: Failed to instantiate LoggerFinder provider; Using default.
java.lang.IllegalStateException: The LogManager was not properly installed (you must set the "java.util.logging.manager" system property to "org.jboss.logmanager.LogManager")
at org.jboss.logmanager.Logger.getLogger(Logger.java:57)
at org.jboss.as.server@12.0.1.Final//org.jboss.as.server.Main.main(Main.java:89)
at org.jboss.modules.Module.run(Module.java:352)
at org.jboss.modules.Module.run(Module.java:320)
at org.jboss.modules.Main.main(Main.java:617)

Then add these two arguments in JAVA_OPTS as well in the same order:

JAVA_OPTS="$JAVA_OPTS -javaagent:$JBOSS_HOME/agent/sixthsense-agent.jar"
JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
//Add these two argument in same order
JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=org.jboss.byteman,org.jboss.logmanager -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dorg.jboss.logging.Logger.pluginClass=org.jboss.logging.logmanager.LoggerPluginImpl"
JAVA_OPTS="$JAVA_OPTS -Dsun.util.logging.disableCallerCheck=true"
//
JAVA_OPTS="$JAVA_OPTS -Xbootclasspath/a:$JBOSS_HOME/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-2.1.14.Final-redhat-00001.jar"
JAVA_OPTS="$JAVA_OPTS -Xbootclasspath/a:$JBOSS_HOME/modules/system/layers/base/org/wildfly/common/main/wildfly-common-1.5.1.Final-redhat-00001.jar"

If the Jboss or WildFly server failed to start with following error,

Could not load Logmanager "org.jboss.logmanager.LogManager"
java.lang.ClassNotFoundException: org.jboss.logmanager.LogManager
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.util.logging.LogManager$1.run(LogManager.java:195)

replace the jboss and wildfly arguments with the following:

JAVA_OPTS="$JAVA_OPTS -Xbootclasspath/a:$JBOSS_HOME/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-2.1.15.Final.jar"
JAVA_OPTS="$JAVA_OPTS -Xbootclasspath/a:$JBOSS_HOME/modules/system/layers/base/org/wildfly/common/main/wildfly-common-1.5.4.Final.jar"