5 Replies Latest reply on Apr 8, 2015 1:37 PM by jamezp

    JBoss AS 7.1.1.Final - java.lang.ClassNotFoundException: org.apache.commons.logging.Log

    tompek

      Hi,

       

      I was installed JOSSO 1.8.9 to the JBoss AS 7.1.1.Final. Installation of JOSSO gateway and JOSSO agent looks ok with known issues for examle from this :

      http://codepk.tumblr.com/post/101409947356/josso-agent-1-8-installation-in-jboss-7-1.

      I have problem with starting of the josso-partner-jboss7-app-1.8.9.ear which is example of applications used JOSSO sso. On the deploy this error appears:

       

      14:41:10,998 WARN  [org.jboss.modules] (MSC service thread 1-4) Failed to define class org.apache.commons.logging.Log in Module "org.slf4j.jcl-over-slf4j:main" from local module loader @625eb12e (roots: D:\Projects\jboss-as-7.1.1.Final\modules): java.lang.LinkageError: loader constraint violation: loader (instance of org/jboss/modules/ModuleClassLoader) previously initiated loading for a different type with name "org/apache/commons/logging/Log"

          at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.7.0_75]

          at java.lang.ClassLoader.defineClass(Unknown Source) [rt.jar:1.7.0_75]

          at java.security.SecureClassLoader.defineClass(Unknown Source) [rt.jar:1.7.0_75]

          at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327) [jboss-modules.jar:1.1.1.GA]

          at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391) [jboss-modules.jar:1.1.1.GA]

          at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243) [jboss-modules.jar:1.1.1.GA]

          at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73) [jboss-modules.jar:1.1.1.GA]

          at org.jboss.modules.Module.loadModuleClass(Module.java:517) [jboss-modules.jar:1.1.1.GA]

          at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182) [jboss-modules.jar:1.1.1.GA]

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]

          at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]

          at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA]

          at org.apache.commons.logging.LogFactory.<clinit>(LogFactory.java:40) [jcl-over-slf4j-1.6.1.jar:1.6.1]

          at org.josso.agent.Lookup.<clinit>(Lookup.java:42) [josso-agents-bin-1.8.9-jaxws.jar:]

          at org.josso.jb7.agent.JOSSOJASPIAuthenticator.<init>(JOSSOJASPIAuthenticator.java:63) [josso-jboss7-agent-1.8.9.jar:1.8.9]

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

          at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) [rt.jar:1.7.0_75]

          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) [rt.jar:1.7.0_75]

          at java.lang.reflect.Constructor.newInstance(Unknown Source) [rt.jar:1.7.0_75]

          at java.lang.Class.newInstance(Unknown Source) [rt.jar:1.7.0_75]

          at org.jboss.as.web.deployment.WarDeploymentProcessor.getInstance(WarDeploymentProcessor.java:378)

          at org.jboss.as.web.deployment.WarDeploymentProcessor.processDeployment(WarDeploymentProcessor.java:210)

          at org.jboss.as.web.deployment.WarDeploymentProcessor.deploy(WarDeploymentProcessor.java:114)

          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.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.runWorker(Unknown Source) [rt.jar:1.7.0_75]

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

          at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_75]

       

      14:41:11,057 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.deployment.subunit."josso-partner-jboss7-app-1.8.9.ear"."josso-partner-jboss7-web-1.8.9.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."josso-partner-jboss7-app-1.8.9.ear"."josso-partner-jboss7-web-1.8.9.war".INSTALL: Failed to process phase INSTALL of subdeployment "josso-partner-jboss7-web-1.8.9.war" of deployment "josso-partner-jboss7-app-1.8.9.ear"

          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.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.runWorker(Unknown Source) [rt.jar:1.7.0_75]

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

          at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_75]

      Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS018096: Error instantiating container component: org.josso.jb7.agent.JOSSOJASPIAuthenticator

          at org.jboss.as.web.deployment.WarDeploymentProcessor.getInstance(WarDeploymentProcessor.java:386)

          at org.jboss.as.web.deployment.WarDeploymentProcessor.processDeployment(WarDeploymentProcessor.java:210)

          at org.jboss.as.web.deployment.WarDeploymentProcessor.deploy(WarDeploymentProcessor.java:114)

          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

          ... 5 more

      Caused by: java.lang.NoClassDefFoundError: org/apache/commons/logging/Log

          at org.apache.commons.logging.LogFactory.<clinit>(LogFactory.java:40) [jcl-over-slf4j-1.6.1.jar:1.6.1]

          at org.josso.agent.Lookup.<clinit>(Lookup.java:42) [josso-agents-bin-1.8.9-jaxws.jar:]

          at org.josso.jb7.agent.JOSSOJASPIAuthenticator.<init>(JOSSOJASPIAuthenticator.java:63) [josso-jboss7-agent-1.8.9.jar:1.8.9]

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

          at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) [rt.jar:1.7.0_75]

          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) [rt.jar:1.7.0_75]

          at java.lang.reflect.Constructor.newInstance(Unknown Source) [rt.jar:1.7.0_75]

          at java.lang.Class.newInstance(Unknown Source) [rt.jar:1.7.0_75]

          at org.jboss.as.web.deployment.WarDeploymentProcessor.getInstance(WarDeploymentProcessor.java:378)

          ... 8 more

      Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.Log from [Module "org.slf4j.jcl-over-slf4j:main" from local module loader @625eb12e (roots: D:\Projects\jboss-as-7.1.1.Final\modules)]

          at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.1.GA]

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]

          at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]

          at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA]

          ... 17 more

       

      It takes no sense to me. This is module.xml from /jboss-as-7.1.1.Final/modules/org/apache/commons/loging/main/

       

      <?xml version="1.0" encoding="UTF-8"?>
      <module-alias xmlns="urn:jboss:module:1.1" name="org.apache.commons.logging" target-name="org.slf4j.jcl-over-slf4j"/>
      

       

      So commons logging using implementation from slf4j.

      Here is module.xml of org.slf4j.jcl-over-slf4j module:

       

      <?xml version="1.0" encoding="UTF-8"?>
      <module xmlns="urn:jboss:module:1.1" name="org.slf4j.jcl-over-slf4j">
          <resources>
              <resource-root path="jcl-over-slf4j-1.6.1.jar"/>
              <!-- Insert resources here -->
          </resources>
      
          <dependencies>
              <module name="org.slf4j"/>
          </dependencies>
      </module>
      

       

      and in jcl-over-slf4j-1.6.1.jar is visible org.apache.commons.logging.Log class.

       

      It is problem with class loading with EAR? How can I fix it? Many thanks for any help.

        • 1. Re: JBoss AS 7.1.1.Final - java.lang.ClassNotFoundException: org.apache.commons.logging.Log
          jamezp

          Does the EAR you're deploying also contain a commons-logging library? It looks like it might. Try removing that library and see if that works.

           

          --

          James R. Perkins

          • 2. Re: JBoss AS 7.1.1.Final - java.lang.ClassNotFoundException: org.apache.commons.logging.Log
            tompek

            Thanks for reply James!

             

            That is good point, Unfortunaly commons-logging library is not included eigther in the ear or war, but I found not necesseary library jcl-over-slf4j.jar there. Jboss have it between modules. I marked it as provided and build ear again. That leads me to find another commons-logging and jcl-over-slf4j libraries or theirs references. I found that module org.josso have commons-logging library is in the module.xml and in the module folder. I removed library from the module folder. I removed reference from resource section of the module.xml, but I left reference in the dependency section:

             

            <dependencies>
                 ...
                 <module name="org.apache.commons.logging"/>
            </dependencies>
            

             

            It is correct? Or I should remove it? The library commons-logging.jar is not visible on the server and the library jcl-over-slf4j.jar is only in the org.slf4j.jcl-over-slf4j.module and referenced from the org.apache.commons.logging.module. In this state problem still persists.

            • 3. Re: JBoss AS 7.1.1.Final - java.lang.ClassNotFoundException: org.apache.commons.logging.Log
              jamezp

              If I understand it correctly you will want to keep the org.apache.commons.logging dependency on your org.josso module.xml. You'll also want to remove the commons-logging library from the resource in the org.josso module.xml. Your deployment should automatically get the org.apache.commons.logging dependency added.

               

              If you're still seeing "previously initiated loading for a different type with name "org/apache/commons/logging/Log"" error then there are still two libraries being loaded.

               

              --

              James R. Perkins

              • 4. Re: JBoss AS 7.1.1.Final - java.lang.ClassNotFoundException: org.apache.commons.logging.Log
                tompek

                Yes, you understand what I want. Thank you very much for your time, I think, I am understanding principles how it should work. Unfortunately I must move our project to Wildfly so attempts with Jboss 7 were stopped. On the Wildfly with Josso I must solve some problems with configuration of the josso security domain first. Thanks for your time again.

                • 5. Re: JBoss AS 7.1.1.Final - java.lang.ClassNotFoundException: org.apache.commons.logging.Log
                  jamezp

                  FWIW the commons-logging module stuff should work the same in WildFly.

                   

                  --

                  James R. Perkins