2 Replies Latest reply on Jan 17, 2012 9:10 PM by David Robison

    ClassNotFoundException: org.slf4j.LoggerFactory but dependency in jboss-deployment-structure

    David Robison Novice

      I am deploying a SAR and my jboss-deployment-structure is as follows:

       

      <jboss-deployment-structure>

          <deployment>

              <dependencies>

                  <module name="deployment.module.InrisDataProvidor"/>

                  <module name="org.apache.commons.codec"/>

                  <module name="org.apache.commons.lang"/>

                  <module name="org.apache.log4j"/>

                  <module name="org.hibernate"/>

                  <module name="org.infinispan"/>

                  <module name="org.jboss.as.clustering.api"/>

                  <module name="org.jboss.as.clustering.impl"/>

                  <module name="org.jboss.as.clustering.infinispan"/>

                  <module name="org.jboss.as.clustering.service"/>

                  <module name="org.jboss.as.clustering.singleton"/>

                  <module name="org.jboss.as.jpa.hibernate" slot="4"/>

                  <module name="org.jboss.as.server"/>

                  <module name="org.jboss.msc"/>

                  <module name="org.jboss.logmanager"/>

                  <module name="org.slf4j"/>

              </dependencies>

          </deployment>

          <module name="deployment.module.InrisDataProvidor">

              <resources>

                  <resource-root path="antlr-2.7.7.jar"/>

                  <resource-root path="hibernate-spatial-1.1.jar"/>

                  <resource-root path="hibernate-spatial-postgis-1.1.jar"/>

                  <resource-root path="orci-commons-lang-1.0.jar"/>

                  <resource-root path="stringtemplate-3.2.1.jar"/>

                  <resource-root path="TravelTimeEngine-Database-1.0.jar"/>

                  <resource-root path="TravelTimeEngine-InrixAccess-1.0.jar"/>

                  <resource-root path="TravelTimeEngine-InrixDataProvidor-1.0.jar"/>

              </resources>

          </module>

      </jboss-deployment-structure>

      but I am getting the error:

       

      Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory from [Module "deployment.module.SQLFuser: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.performLoadClass(ConcurrentClassLoader.java:398)

          at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

      Even though org.slf4j is in the deployment descriptor. Any ideas? David

        • 1. Re: ClassNotFoundException: org.slf4j.LoggerFactory but dependency in jboss-deployment-structure
          David Robison Novice

          I've check with the latest trunk build and it has the same problem. David

          • 2. Re: ClassNotFoundException: org.slf4j.LoggerFactory but dependency in jboss-deployment-structure
            David Robison Novice

            I turned on DEBUG logging. The org.slf4j module is loaded in several places:

             

            21:04:32,026 DEBUG [org.jboss.as.clustering.infinispan.subsystem] (ServerService Thread Pool -- 35) Cache service for cache entity installed for container hibernate

            21:04:32,028 DEBUG [org.jboss.modules] (MSC service thread 1-1) Module org.slf4j.impl:main defined by local module loader @32269133 (roots: C:\Tools\jboss-as-7.1.0.Final-SNAPSHOT\modules)

            21:04:32,032 DEBUG [org.jboss.as.clustering.infinispan.subsystem] (ServerService Thread Pool -- 35) Cache configuration service for local-query installed for container hibernate

            ...

            21:04:32,108 DEBUG [org.jboss.osgi.framework.internal.BundleManager] (MSC service thread 1-8)  org.jboss.osgi.system.packages = javax.imageio, javax.imageio.stream, javax.management, javax.management.loading, javax.management.modelmbean, javax.management.monitor, javax.management.openmbean, javax.management.relation, javax.management.remote, javax.management.remote.rmi, javax.management.timer, javax.naming, javax.naming.event, javax.naming.spi, javax.net, javax.net.ssl, javax.security.cert, javax.xml.datatype, javax.xml.namespace, javax.xml.parsers, javax.xml.validation, javax.xml.transform, javax.xml.transform.dom, javax.xml.transform.sax, javax.xml.transform.stream, org.jboss.modules, org.w3c.dom, org.w3c.dom.bootstrap, org.w3c.dom.ls, org.w3c.dom.events, org.w3c.dom.ranges, org.w3c.dom.views, org.w3c.dom.traversal, org.xml.sax, org.xml.sax.ext, org.xml.sax.helpers, org.jboss.modules;version=1.0, org.jboss.msc.service;version=1.0, org.jboss.osgi.deployment.deployer;version=1.0, org.jboss.osgi.deployment.interceptor;version=1.0, org.jboss.osgi.framework;version=1.0, org.jboss.osgi.framework.url;version=1.0, org.jboss.osgi.modules;version=1.0, org.jboss.osgi.spi.capability;version=1.0, org.jboss.osgi.spi.util;version=1.0, org.jboss.osgi.testing;version=1.0, org.jboss.osgi.vfs;version=1.0, org.osgi.framework;version=1.5, org.osgi.framework.hooks;version=1.0, org.osgi.framework.hooks.service;version=1.0, org.osgi.framework.launch;version=1.0, org.osgi.service.condpermadmin;version=1.1, org.osgi.service.packageadmin;version=1.2, org.osgi.service.permissionadmin;version=1.2, org.osgi.service.startlevel;version=1.1, org.osgi.service.url;version=1.0, org.osgi.util.tracker;version=1.4, javax.inject,, org.apache.commons.logging;version=1.1.1, org.apache.log4j;version=1.2, org.jboss.as.configadmin.service;version=7.0, org.jboss.as.osgi.service;version=7.0, org.jboss.logging;version=3.0.0, org.slf4j;version=1.5.10

            21:04:32,108 DEBUG [org.jboss.osgi.framework.internal.BundleManager] (MSC service thread 1-8)  org.osgi.framework.storage.clean = onFirstInit

            21:04:32,108 DEBUG [org.jboss.osgi.framework.internal.BundleManager] (MSC service thread 1-8)  org.osgi.framework.os.name = Windows 7

            21:04:32,109 DEBUG [org.jboss.osgi.framework.internal.BundleManager] (MSC service thread 1-8)  org.osgi.framework.startlevel.beginning = 1

            21:04:32,109 DEBUG [org.jboss.osgi.framework.internal.BundleManager] (MSC service thread 1-8)  org.jboss.osgi.system.modules = javax.api,javax.inject.api,org.apache.commons.logging,org.apache.log4j,org.jboss.as.configadmin,org.jboss.as.osgi,org.jboss.logging,org.jboss.modules,org.jboss.msc,org.jboss.osgi.framework,org.slf4j

            21:04:32,109 DEBUG [org.jboss.osgi.framework.internal.BundleManager] (MSC service thread 1-8)  org.osgi.framework.executionenvironment = OSGi/Minimum-1.1, J2SE-1.1, OSGi/Minimum-1.2, J2SE-1.2, J2SE-1.3, J2SE-1.4, J2SE-1.5, JavaSE-1.6

            21:04:32,109 DEBUG [org.jboss.osgi.framework.internal.BundleManager] (MSC service thread 1-8)  org.osgi.framework.vendor = jboss.org

            21:04:32,109 DEBUG [org.jboss.osgi.framework.internal.BundleManager] (MSC service thread 1-8)  org.osgi.framework.system.packages.extra = javax.imageio, javax.imageio.stream, javax.management, javax.management.loading, javax.management.modelmbean, javax.management.monitor, javax.management.openmbean, javax.management.relation, javax.management.remote, javax.management.remote.rmi, javax.management.timer, javax.naming, javax.naming.event, javax.naming.spi, javax.net, javax.net.ssl, javax.security.cert, javax.xml.datatype, javax.xml.namespace, javax.xml.parsers, javax.xml.validation, javax.xml.transform, javax.xml.transform.dom, javax.xml.transform.sax, javax.xml.transform.stream, org.jboss.modules, org.w3c.dom, org.w3c.dom.bootstrap, org.w3c.dom.ls, org.w3c.dom.events, org.w3c.dom.ranges, org.w3c.dom.views, org.w3c.dom.traversal, org.xml.sax, org.xml.sax.ext, org.xml.sax.helpers, org.jboss.modules;version=1.0, org.jboss.msc.service;version=1.0, org.jboss.osgi.deployment.deployer;version=1.0, org.jboss.osgi.deployment.interceptor;version=1.0, org.jboss.osgi.framework;version=1.0, org.jboss.osgi.framework.url;version=1.0, org.jboss.osgi.modules;version=1.0, org.jboss.osgi.spi.capability;version=1.0, org.jboss.osgi.spi.util;version=1.0, org.jboss.osgi.testing;version=1.0, org.jboss.osgi.vfs;version=1.0, org.osgi.framework;version=1.5, org.osgi.framework.hooks;version=1.0, org.osgi.framework.hooks.service;version=1.0, org.osgi.framework.launch;version=1.0, org.osgi.service.condpermadmin;version=1.1, org.osgi.service.packageadmin;version=1.2, org.osgi.service.permissionadmin;version=1.2, org.osgi.service.startlevel;version=1.1, org.osgi.service.url;version=1.0, org.osgi.util.tracker;version=1.4, javax.inject,, org.apache.commons.logging;version=1.1.1, org.apache.log4j;version=1.2, org.jboss.as.configadmin.service;version=7.0, org.jboss.as.osgi.service;version=7.0, org.jboss.logging;version=3.0.0, org.slf4j;version=1.5.10

            21:04:32,109 DEBUG [org.jboss.osgi.framework.internal.BundleManager] (MSC service thread 1-8)  org.osgi.framework.language = en

             

            Then it is loaded as part of the module dependencies for the SAR:

             

            21:04:34,181 DEBUG [org.jboss.as.server.deployment.module] (MSC service thread 1-2) Adding dependency ModuleDependency [identifier=org.slf4j:main, moduleLoader=Service Module Loader, export=false, optional=false, importServices=false] to module deployment.TravelTimeEngine-InrixDataProvidor-1.0.sar:main

            21:04:34,181 DEBUG [org.jboss.as.server.deployment.module] (MSC service thread 1-2) Adding dependency ModuleDependency [identifier=org.slf4j:main, moduleLoader=Service Module Loader, export=false, optional=false, importServices=false] to module deployment.TravelTimeEngine-InrixDataProvidor-1.0.sar:main

            21:04:34,181 DEBUG [org.jboss.as.server.deployment.module] (MSC service thread 1-2) Adding dependency ModuleDependency [identifier=org.slf4j:main, moduleLoader=local module loader @32269133 (roots: C:\Tools\jboss-as-7.1.0.Final-SNAPSHOT\modules), export=false, optional=false, importServices=false] to module deployment.TravelTimeEngine-InrixDataProvidor-1.0.sar:main

            21:04:34,181 DEBUG [org.jboss.as.server.deployment.module] (MSC service thread 1-2) Adding dependency ModuleDependency [identifier=org.apache.log4j:main, moduleLoader=local module loader @32269133 (roots: C:\Tools\jboss-as-7.1.0.Final-SNAPSHOT\modules), export=false, optional=false, importServices=false] to module deployment.TravelTimeEngine-InrixDataProvidor-1.0.sar:main

             

            However, the jars do not seem to be put on the class path as the SAR reports the class not found.

            Caused by: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory

                at com.orci.commons.lang.properties.PropertyFileWatcher.<clinit>(PropertyFileWatcher.java:19)

                at com.orci.TravelTimeEngine.InrixDataProvidor.InrixDataSvc.start(InrixDataSvc.java:63)

                at org.jboss.as.clustering.singleton.SingletonService.startNewMaster(SingletonService.java:153)

                at org.jboss.as.clustering.singleton.SingletonService.serviceProvidersChanged(SingletonService.java:127)

                at org.jboss.as.clustering.service.ServiceProviderRegistryService.register(ServiceProviderRegistryService.java:95)

                at org.jboss.as.clustering.singleton.SingletonService.start(SingletonService.java:97)

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]

                ... 3 more

            Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory from [Module "deployment.module.InrisDataProvidor:main" from Service Module Loader]

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

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

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

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

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

                ... 11 more

            Any thoughts or ideas? David