ClassCastException when adding JBoss LogManager to the boot classpath in EAP 6.1.0
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 6.1.0
Issue
- Users need to install a Java agent (e.g. Introscope or JMX agent) on my JBoss JVM. They followed the instructions in the solution that solves this (also addressed Content from issues.jboss.org is not included.here), but when they upgrade to EAP 6.1.0, the workaround fails, and get this error:
09:28:18,984 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 5) JBAS014612: Operation ("add") failed - address: ([
("subsystem" => "logging"),
("console-handler" => "CONSOLE")
]): java.lang.ClassCastException: org.jboss.logmanager.PropertyConfigurator cannot be cast to org.jboss.as.logging.logmanager.ConfigurationPersistence
at org.jboss.as.logging.logmanager.ConfigurationPersistence.getOrCreateConfigurationPersistence(ConfigurationPersistence.java:93)
at org.jboss.as.logging.logmanager.ConfigurationPersistence.getOrCreateConfigurationPersistence(ConfigurationPersistence.java:81)
at org.jboss.as.logging.LoggingOperations$LoggingOperationStepHandler.execute(LoggingOperations.java:154)
at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:440) [jboss-as-controller-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:322) [jboss-as-controller-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.jboss.as.controller.AbstractOperationContext.completeStepInternal(AbstractOperationContext.java:229) [jboss-as-controller-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:224) [jboss-as-controller-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.jboss.as.controller.ParallelBootOperationStepHandler$ParallelBootTask.run(ParallelBootOperationStepHandler.java:334) [jboss-as-controller-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [classes.jar:1.6.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [classes.jar:1.6.0_45]
at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_45]
at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.0.Final-redhat-1.jar:2.1.0.Final-redhat-1]
- ClassCastException when JBoss LogManager is initialized before the logging subsystem
Resolution
Upgrade to JBoss EAP 6.1.1 or later.
A workaround for JBoss EAP 6.1.0 is to remove the -Dlogging.configuration system property from your command line script. This will essentially disable logging until the logging subsystem has been bootstrapped, but once it's bootstrapped, logging will function as usual. The logging system is bootstrapped rather early in the boot sequence, but you will lose a handful of messages. Please not this workaround does not work in domain mode, it only works in standalone mode.
Root Cause
-
Having the JBoss LogManager initialize itself before JBoss code had begun to execute was not a use case that had been considered when overhauling the logging subystem for EAP 6.1.0.
-
ClassCastException when JBoss LogManager is initialized before the logging subsystem expects:
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.