JBoss Issue with external Java Agent

Issue

When trying to start JBoss 6.x with the javaagent parameter in JAVA_OPTS, JBoss errors out and doesn’t start. This is a known bug with JBoss as documented by Redhat (article no: https://access.redhat.com/solutions/312453).

The following is the error message:

1
log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies).
2
log4j:WARN Please initialize the log4j system properly.
3
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
4
WARNING: Failed to load the specified log manager class org.jboss.logmanager.LogManager
5
Sep 13, 2017 1:58:11 AM org.jboss.msc.service.ServiceContainerImpl <clinit>
6
INFO: JBoss MSC version 1.0.4.GA-redhat-1
7
Sep 13, 2017 1:58:12 AM org.jboss.as.server.ApplicationServerService start
8
INFO: JBAS015899: JBoss EAP 6.2.0.GA (AS 7.3.0.Final-redhat-14) starting
9
Sep 13, 2017 1:58:17 AM org.jboss.as.controller.AbstractOperationContext executeStep
10
ERROR: JBAS014612: Operation ("parallel-extension-add") failed - address: ([])
11
java.lang.RuntimeException: JBAS014670: Failed initializing module org.jboss.as.logging
12
at org.jboss.as.controller.extension.ParallelExtensionAddHandler$1.execute(ParallelExtensionAddHandler.java:99)
13
at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:607)
14
at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:485)
15
at org.jboss.as.controller.AbstractOperationContext.completeStepInternal(AbstractOperationContext.java:282)
16
at org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:277)
17
at org.jboss.as.controller.ModelControllerImpl.boot(ModelControllerImpl.java:269)
18
at org.jboss.as.controller.AbstractControllerService.boot(AbstractControllerService.java:291)
19
at org.jboss.as.server.ServerService.boot(ServerService.java:349)
20
at org.jboss.as.server.ServerService.boot(ServerService.java:324)
21
at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:253)
22
at java.lang.Thread.run(Thread.java:748)
23
Caused by: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: JBAS011592: The logging subsystem requires the log manager to be org.jboss.logmanager.LogManager. The subsystem has not be initialized and cannot be used. To use JBoss Log Manager you must add the system property "java.util.logging.manager" and set it to "org.jboss.logmanager.LogManager"
24
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
25
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
26
at org.jboss.as.controller.extension.ParallelExtensionAddHandler$1.execute(ParallelExtensionAddHandler.java:91)
27
... 10 more
28
Caused by: java.lang.IllegalStateException: JBAS011592: The logging subsystem requires the log manager to be org.jboss.logmanager.LogManager. The subsystem has not be initialized and cannot be used. To use JBoss Log Manager you must add the system property "java.util.logging.manager" and set it to "org.jboss.logmanager.LogManager"
29
at org.jboss.as.logging.LoggingExtension.initialize(LoggingExtension.java:110)
30
at org.jboss.as.controller.extension.ExtensionAddHandler.initializeExtension(ExtensionAddHandler.java:97)
31
at org.jboss.as.controller.extension.ParallelExtensionAddHandler$ExtensionInitializeTask.call(ParallelExtensionAddHandler.java:127)
32
at org.jboss.as.controller.extension.ParallelExtensionAddHandler$ExtensionInitializeTask.call(ParallelExtensionAddHandler.java:113)
33
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
34
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
35
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
36
at java.lang.Thread.run(Thread.java:748)
37
at org.jboss.threads.JBossThread.run(JBossThread.java:122)
38
39
Sep 13, 2017 1:58:17 AM org.jboss.as.server.ServerService boot
40
**FATAL: JBAS015957: Server boot has failed in an unrecoverable manner; exiting. See previous messages for details.**

Version Applicable: JBoss 6.x

Work Around

Redhat has a documented work around for the same. To make it applicable for tcell, please complete the following steps:

  1. Edit the standalone.sh file (vi standalone.sh)

  2. Add the following entry:

    1
    ```
    2
    XXX=/opt/EAP-6.2.0/jboss-eap-6.2
    3
    JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Xbootclasspath/p:${XXX}/modules/system/layers/base/org/jboss/logmanager/main/jboss\
    4
    -logmanager-1.5.1.Final-redhat-1.jar:${XXX}/modules/system/layers/base/org/jboss/log4j/logmanager/main/log4j-jboss-logmanager-1.5.1.Final-redhat-1.jar"
    5
    JAVA_OPTS="$JAVA_OPTS -javaagent:/opt/tcell/tcellagent.jar"
    6
    JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=org.jboss.byteman,org.jboss.logmanager"
    7
    ```
  3. Please make sure the folder location for xxx is the install location for JBoss

  4. Please make sure the jboss-logmanager-1.x.x.Final-redhat-1.jar location is adjusted.

  5. At the command prompt, execute export JAVA_OPTS="$JAVA_OPTS -javaagent:/opt/tcell/tcellagent.jar"

  6. Please make sure the location of the tcellagent is set accordingly (this is for testing purpose and can be adjusted to be part of another file once the testing is completed to suit the application needs)

  7. Start JBoss.

  8. The following should be the output and JBoss should have started successfully

bash
1
root@ip-172-31-6-108:/opt/EAP-6.2.0/jboss-eap-6.2/bin# ./standalone.sh 
2
3
JAVA_OPTS already set in environment; overriding default settings with values:  -javaagent:/opt/tcell/tcellagent.jar -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Xbootclasspath/p:/opt/EAP-6.2.0/jboss-eap-6.2/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-1.5.1.Final-redhat-1.jar:/opt/EAP-6.2.0/jboss-eap-6.2/modules/system/layers/base/org/jboss/log4j/logmanager/main/log4j-jboss-logmanager-1.5.1.Final-redhat-1.jar -Djboss.modules.system.pkgs=org.jboss.byteman,org.jboss.logmanager
4
5
=========================================================================
6
7
  JBoss Bootstrap Environment
8
9
  JBOSS_HOME: /opt/EAP-6.2.0/jboss-eap-6.2
10
11
  JAVA: java
12
13
  JAVA_OPTS:  -server -XX:+UseCompressedOops  -javaagent:/opt/tcell/tcellagent.jar -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Xbootclasspath/p:/opt/EAP-6.2.0/jboss-eap-6.2/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-1.5.1.Final-redhat-1.jar:/opt/EAP-6.2.0/jboss-eap-6.2/modules/system/layers/base/org/jboss/log4j/logmanager/main/log4j-jboss-logmanager-1.5.1.Final-redhat-1.jar -Djboss.modules.system.pkgs=org.jboss.byteman,org.jboss.logmanager
14
15
=========================================================================
16
17
log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies).
18
log4j:WARN Please initialize the log4j system properly.
19
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
20
02:02:31,297 INFO  [org.jboss.modules] (main) JBoss Modules version 1.3.0.Final-redhat-2
21
02:02:32,457 INFO  [org.jboss.msc] (main) JBoss MSC version 1.0.4.GA-redhat-1
22
02:02:33,182 INFO  [org.jboss.as] (MSC service thread 1-2) JBAS015899: JBoss EAP 6.2.0.GA (AS 7.3.0.Final-redhat-14) starting
23
02:02:38,924 INFO  [org.xnio] (MSC service thread 1-4) XNIO Version 3.0.7.GA-redhat-1
24
02:02:38,977 INFO  [org.xnio.nio] (MSC service thread 1-4) XNIO NIO Implementation Version 3.0.7.GA-redhat-1
25
02:02:38,974 INFO  [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http)
26
02:02:39,031 INFO  [org.jboss.remoting] (MSC service thread 1-4) JBoss Remoting version 3.2.18.GA-redhat-1
27
02:02:39,368 INFO  [org.jboss.as.jsf] (ServerService Thread Pool -- 35) JBAS012605: Activated the following JSF Implementations: [main, 1.2]
28
02:02:39,376 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 37) JBAS011800: Activating Naming Subsystem
29
02:02:39,440 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 29) JBAS010280: Activating Infinispan subsystem.
30
02:02:39,441 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 42) JBAS013171: Activating Security Subsystem
31
02:02:39,607 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 46) JBAS015537: Activating WebServices Extension
32
02:02:39,626 INFO  [org.jboss.as.security] (MSC service thread 1-3) JBAS013170: Current PicketBox version=4.0.19.SP2-redhat-1
33
02:02:39,885 INFO  [org.jboss.as.naming] (MSC service thread 1-1) JBAS011802: Starting Naming Service
34
02:02:40,030 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-4) JBAS015400: Bound mail session [java:jboss/mail/Default]
35
02:02:40,044 INFO  [org.jboss.as.connector.logging] (MSC service thread 1-4) JBAS010408: Starting JCA Subsystem (IronJacamar 1.0.23.Final-redhat-1)
36
02:02:40,488 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 25) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
37
02:02:42,692 INFO  [org.jboss.ws.common.management] (MSC service thread 1-3) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.2.3.Final-redhat-1
38
02:02:42,866 INFO  [org.apache.coyote.http11] (MSC service thread 1-2) JBWEB003001: Coyote HTTP/1.1 initializing on : http-/127.0.0.1:8080
39
02:02:42,920 INFO  [org.apache.coyote.http11] (MSC service thread 1-2) JBWEB003000: Coyote HTTP/1.1 starting on: http-/127.0.0.1:8080
40
02:02:43,431 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
41
02:02:44,746 INFO  [org.jboss.as.remoting] (MSC service thread 1-3) JBAS017100: Listening on 127.0.0.1:9999
42
02:02:44,746 INFO  [org.jboss.as.remoting] (MSC service thread 1-2) JBAS017100: Listening on 127.0.0.1:4447
43
02:02:44,761 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-1) JBAS015012: Started FileSystemDeploymentService for directory /opt/EAP-6.2.0/jboss-eap-6.2/standalone/deployments
44
02:02:45,071 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
45
02:02:45,071 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
46
02:02:45,072 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss EAP 6.2.0.GA (AS 7.3.0.Final-redhat-14) started in 15324ms - Started 129 of 186 services (56 services are passive or on-demand)