[jboss-dev-forums] [JBoss AS 7 Development] - Logging with slf4j in 7.1.0.Final

Dan D do-not-reply at jboss.com
Wed Feb 22 19:53:48 EST 2012


Dan D [https://community.jboss.org/people/norad_2] created the discussion

"Logging with slf4j in 7.1.0.Final"

To view the discussion, visit: https://community.jboss.org/message/718928#718928

--------------------------------------------------------------
Hi All,

In 7.1.0.CR1b I could include my own slf4j-api/slf4j12 and log4j.xml and have my application not use the JBoss logging modules.

I did this for the following reasons:
1. JBoss logging seems to be based on java.util.logging, which has no support for Message Diagnostic Context, which I use heavily
2. JBoss logging currently has no support for JMS Appenders like org.apache.log4j.net.JMSAppender

Based on what I see in this JIRA, and what I am seeing since I upgraded from CR1b to Final, it seems like JBoss logging has been forced onto us.
 https://issues.jboss.org/browse/AS7-1389 https://issues.jboss.org/browse/AS7-1389
"Log API dependencies should be included automatically in deployments"

The JIRA mentions being able to exclude the logging dependencies if I want to bring in my own.

I created a jboss-deployment-structure file




Now when I try to startup JBoss, I get warnings and errors and JBoss does not startup


00:30:07,297 WARN   org.jboss.modules org.jboss.modules  https://community.jboss.org/message/718928#718928#718928/MSC service thread 1-3 Logging with slf4j in 7.1.0.Final Failed to define class org.slf4j.Logger in Module "deployment.project.ear:main" from Service Module Loader: java.lang.LinkageError: loader constraint violation: loader (instance of org/jboss/modules/ModuleClassLoader) previously initiated loading for a different type with name "org/slf4j/Logger"



00:30:07,308 ERROR  org.jboss.msc.service.fail org.jboss.msc.service.fail  https://community.jboss.org/message/718928#718928#718928/MSC service thread 1-3 Logging with slf4j in 7.1.0.Final MSC00001: Failed to start service jboss.deployment.subunit."project.ear"."project-services.jar".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."project.ear"."project-services.jar".POST_MODULE: Failed to process phase POST_MODULE of subdeployment "project-services.jar" of deployment "project.ear"
          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) jboss-as-server-7.1.0.Final.jar:7.1.0.Final
          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) jboss-msc-1.0.2.GA.jar:1.0.2.GA
          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) jboss-msc-1.0.2.GA.jar:1.0.2.GA
          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)  https://community.jboss.org/message/718928#718928#718928/rt.jar:1.6.0_29 Logging with slf4j in 7.1.0.Final
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)  https://community.jboss.org/message/718928#718928#718928/rt.jar:1.6.0_29 Logging with slf4j in 7.1.0.Final
          at java.lang.Thread.run(Thread.java:662)  https://community.jboss.org/message/718928#718928#718928/rt.jar:1.6.0_29 Logging with slf4j in 7.1.0.Final
Caused by: java.lang.RuntimeException: Error getting reflective information for class com.example.project.package.api.remote.AbstractServiceLocator with ClassLoader ModuleClassLoader for Module "deployment.project.ear:main" from Service Module Loader
          at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70) jboss-as-server-7.1.0.Final.jar:7.1.0.Final
          at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:58)
          at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:70)
          at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:117)
          at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:54)
          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) jboss-as-server-7.1.0.Final.jar:7.1.0.Final
          ... 5 more
Caused by: java.lang.NoClassDefFoundError: org/slf4j/Logger
          at java.lang.Class.getDeclaredMethods0(Native Method)  https://community.jboss.org/message/718928#718928#718928/rt.jar:1.6.0_29 Logging with slf4j in 7.1.0.Final
          at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)  https://community.jboss.org/message/718928#718928#718928/rt.jar:1.6.0_29 Logging with slf4j in 7.1.0.Final
          at java.lang.Class.getDeclaredMethods(Class.java:1791)  https://community.jboss.org/message/718928#718928#718928/rt.jar:1.6.0_29 Logging with slf4j in 7.1.0.Final
          at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.(ClassReflectionIndex.java:65) jboss-as-server-7.1.0.Final.jar:7.1.0.Final
          at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:66) jboss-as-server-7.1.0.Final.jar:7.1.0.Final
          ... 10 more
Caused by: java.lang.ClassNotFoundException: org.slf4j.Logger from [Module "deployment.project.ear:main" from Service Module Loader]
          at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
          at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)
          at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
          at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
          ... 15 more



I have the necessary slf4j jars included in my ear, and this is all working fine in CR1b.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/718928#718928]

Start a new discussion in JBoss AS 7 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20120222/ea6b3327/attachment.html 


More information about the jboss-dev-forums mailing list