0 Replies Latest reply on Jun 11, 2012 12:04 PM by Eran Kazula

    Exclusion of "logmanager" module from WEB application (war) in JBoss AS 7

    Eran Kazula Newbie

      Hello,

       

      I've created a simple WEB application which has a customized logging mechanism based on log4j. The WAR file of this application contains a "log4j" jar file.

       

      The problem is that when I deploy the WAR file into JBoss AS 7 (version 7.1.1 to be exact), I get a "ClassCastException" (see the full stack-trace below).

       

      After google-ing about the issue a bit, it seemed that excluding the "org.jboss.logmanager" and / or "org.jboss.logmanager.log4j" modules from the WEB application deployment should resolve this issue. I've attempted to perform this exclusion by adding a 'jboss-deployment-structure.xml' file to the WAR file (under the 'WEB-INF' folder), but for some reason it just doesn't seem to make any difference...

       

      Here is my 'jboss-deployment-structure.xml' file content:

       

      <jboss-deployment-structure>
            <deployment>
                  <exclusions>
                       <module name="org.jboss.logmanager" slot="main"/>
                       <module name="org.jboss.logmanager.log4j" slot="main"/>
                  </exclusions>
            </deployment>
      </jboss-deployment-structure>

       

       

      Just FYI - I've tried "playing-around" with these exclusion instructions un-successfully (e.g. with/withou the 'slot' attribute; with/without just one of these modules; with/without a '<sub-deployment>' tag; etc'...). 

       

      Any tips on how to get this issue resolved would be much appriciated!

       

      Thanks,

      Eran.

        

       

      18:45:06,253 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/${phase}/]] (MSC service thread 1-4) Error configuring application listener of class com.myproject.InitApp: java.lang.ExceptionInInitializerError

      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.7.0]

      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) [rt.jar:1.7.0]

      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.7.0]

      at java.lang.reflect.Constructor.newInstance(Constructor.java:525) [rt.jar:1.7.0]

      at org.jboss.msc.value.ConstructedValue.getValue(ConstructedValue.java:61)

      at org.jboss.as.naming.ValueManagedReferenceFactory.getReference(ValueManagedReferenceFactory.java:49)

      at org.jboss.as.ee.component.ManagedReferenceInterceptorFactory$ManagedReferenceInterceptor.processInvocation(ManagedReferenceInterceptorFactory.java:90) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

      at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

      at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

      at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

      at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:161) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

      at org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:85) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

      at org.jboss.as.web.deployment.component.WebComponentInstantiator$1.<init>(WebComponentInstantiator.java:57) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

      at org.jboss.as.web.deployment.component.WebComponentInstantiator.getReference(WebComponentInstantiator.java:55) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

      at org.jboss.as.web.deployment.WebInjectionContainer.instantiate(WebInjectionContainer.java:99) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

      at org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:78) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

      at org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:72) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

      at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3342) [jbossweb-7.0.13.Final.jar:]

      at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:]

      at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

      at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0]

      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0]

      at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0]

      Caused by: java.lang.ClassCastException: org.jboss.logmanager.log4j.BridgeLogger cannot be cast to myapp.logging.MyLogger

      at myapp.logging.MyLogger.getMyLogger(ContextLogger.java:139) [ContextLogger-2.0.0.jar:]

      at myapp.logging.MyLogger.getMyLogger(ContextLogger.java:111) [ContextLogger-2.0.0.jar:]

      at com.myproject.InitApp.<clinit>(InitApp.java:29) [classes:]