11 Replies Latest reply on Nov 14, 2011 6:55 AM by viniciuscarvalho

    Help with classloading

    viniciuscarvalho

      Hi there! I'm having some issues with classloading here.

       

      I have a ejbModule that contains a CDI extension.

       

      Basically I have a jar with all the interfaces, and a jar for the implementation.

       

      service-api.jar

      service-impl.jar

       

      On my initial tests running inside a WAR it was working fine, but since I deployed this in a EAR I can't get it to work

       

      First I had the api inside the lib:

       

      myear

        +- lib

          - service-api.jar

      - service-impl.jar

       

       

      I thought the classloader would be able to see the classes inside the lib folder.

       

      I tried to add the api as a java module, but the problem persists.

       

      Is it possible to declare dependencies without having to tweak the Class-path entry of my ejb.jar MANIFES file?

       

      Regards

        • 1. Re: Help with classloading
          viniciuscarvalho

          Well, I tried to add a Class-path entry to my ejb-jar and the problem persists.

           

          What is really odd, is if I have a service, EJB, CDI service, you name it. That depends on the api-jar, it works ok. The problem only happens with the Weld deployer for the extensions.

           

          This is really an annoying bug.

          • 2. Re: Help with classloading
            alesj

            AS7 is more strict on .ear' jars visibility.

            Check the AS7 docs on this subject - imo that's your issue.

            • 3. Re: Help with classloading
              viniciuscarvalho

              Hi Ales, I did check https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7 and https://docs.jboss.org/author/display/AS7/How+do+I+migrate+my+application+from+AS5+or+AS6+to+AS7

               

              but none of them helped.

               

              I tried to deploy my app on JBoss 6.1 and it worked, so yeah I'm assuming is something new with the classloading on AS 7.

               

              Just can't figure what. As I did add the Class-path: ./lib/service-api.jar on my Manifest, from what I read on the docs that should be enough to make the

              class visible to the classloader.

               

              Another way would be using Dependencies right? But besides using it to load modules from the AS I really did not find any reference on using them

              to load you app modules.

               

              Really can't find the issue by reading the docs, that's why I came here.

               

              Regards

              • 4. Re: Help with classloading
                alesj

                Afaik there is a flag in jboss-deployment-structure.xml which enables cross ear visibility for all jars.

                • 5. Re: Help with classloading
                  viniciuscarvalho

                  Here's what I don't get:

                   

                  my ejb-jar is defining a dependency on api-jar using class-path entry. api-jar is on the lib folder.

                   

                  By definition, shouldn't the lib folder classes be available to all modules?

                   

                  Also, it says on the docs that module isolation is off by default. I'm going to give a try with the jboss-deployment-structure.

                   

                  Forgive me my lack of knowledge on this, but what does the spec says on this? It really seems that anything on the lib folder of an ear should be visible to all sub modules of it.

                   

                  Regards

                  • 6. Re: Help with classloading
                    jaikiran

                    What exact errors do you get? The jars in .ear/lib/ are visible to all sub deployments including the service-impl.jar (which you say is a EJB jar).

                    • 7. Re: Help with classloading
                      viniciuscarvalho

                      ClassNotFound and Linkage Errors.

                       

                      I pretty much tried all the combinations you can imagine, from the docs.

                       

                      My ear is really simple:

                       

                      service-impl contains some EJBs and a CDI Extension (along with required beans.xml and the javax.enterprise.inject.spi.Extension files)

                       

                      service-impl extension implements some interfaces that are contained inside the service-api.jar

                       

                      The ear looks like this:

                       

                      EAR/

                           lib/

                              service-api.jar

                      service-impl.jar

                       

                      (ommiting the application.xml here)

                       

                      So I get the Classnotfound and linkage errors when trying to load the extension, it says it can not find the class for the interface it defines.

                       

                      So far I tried:

                       

                      1 - Edit MANIFES.MF from ejb-jar file and add Class-path entry as : Class-path: ./lib/service-api.jar

                      2 - Put the service-api.jar as a java module of the ear

                      3 - put the service-api.jar as a java module and then add a jboss-deployment-structure.xml:

                      <jboss-deployment-structure>

                        <!-- Make sub deployments isolated by default, so they cannot see each others classes without a Class-Path entry -->

                        <ear-subdeployments-isolated>false</ear-subdeployments-isolated>

                      </jboss-deployment-structure>

                      4 - Put the service api back on the lib and add the deployment-structure above

                       

                      All of those have failed.

                       

                      Running out of ideas here guys

                       

                      Regards

                      • 8. Re: Help with classloading
                        jaikiran

                        Please post the real exception stacktraces, that'll help us understand what's going on.

                        • 9. Re: Help with classloading
                          viniciuscarvalho

                          Hi, I've moved back to war deployment as it works now.

                           

                          I tried to revert to the ear file, but seems that I can't get the same error now, probably some mistake.

                           

                          On previous stacks I had not only the implementation class was not found (GemFireCacheManager) but also on the logs there was a mention to a linkage error on CacheManager (the api-jar).

                           

                          Here's the stack:

                           

                           

                          17:39:00,915 DEBUG [org.jboss.weld.ClassLoading] (MSC service thread 1-3) catching: org.jboss.weld.resources.spi.ResourceLoadingException: java.lang.ClassNotFoundException: com.ericsson.oss.one.platform.services.extensions.GemFireExtension from [Module "deployment.pci-ear-0.0.1-SNAPSHOT.ear.service-bus-gemfire-0.0.1-SNAPSHOT.jar:main" from Service Module Loader]
                                    at org.jboss.as.weld.WeldModuleResourceLoader.classForName(WeldModuleResourceLoader.java:74) [jboss-as-weld-7.0.2.Final.jar:7.0.2.Final]
                                    at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:82) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:134) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:191) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:368) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:81) [jboss-as-weld-7.0.2.Final.jar:7.0.2.Final]
                                    at org.jboss.as.weld.services.WeldService.start(WeldService.java:89) [jboss-as-weld-7.0.2.Final.jar:7.0.2.Final]
                                    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)
                                    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)
                                    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_21]
                                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_21]
                                    at java.lang.Thread.run(Thread.java:619) [:1.6.0_21]
                          Caused by: java.lang.ClassNotFoundException: com.ericsson.oss.one.platform.services.extensions.GemFireExtension from [Module "deployment.pci-ear-0.0.1-SNAPSHOT.ear.service-bus-gemfire-0.0.1-SNAPSHOT.jar:main" from Service Module Loader]
                                    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191)
                                    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:361)
                                    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:310)
                                    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:103)
                                    at org.jboss.as.weld.WeldModuleResourceLoader.classForName(WeldModuleResourceLoader.java:68) [jboss-as-weld-7.0.2.Final.jar:7.0.2.Final]
                                    ... 11 more
                          
                          
                          17:39:00,919 DEBUG [org.jboss.weld.ClassLoading] (MSC service thread 1-3) WELD-000119 Not generating any bean definitions from com.ericsson.oss.one.platform.cache.GemFireCacheManager because of underlying class loading error
                          17:39:00,919 DEBUG [org.jboss.weld.ClassLoading] (MSC service thread 1-3) catching: org.jboss.weld.resources.spi.ResourceLoadingException: java.lang.ClassNotFoundException: com.ericsson.oss.one.platform.cache.GemFireCacheManager from [Module "deployment.pci-ear-0.0.1-SNAPSHOT.ear.service-bus-gemfire-0.0.1-SNAPSHOT.jar:main" from Service Module Loader]
                                    at org.jboss.as.weld.WeldModuleResourceLoader.classForName(WeldModuleResourceLoader.java:74) [jboss-as-weld-7.0.2.Final.jar:7.0.2.Final]
                                    at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:82) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:134) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:191) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:368) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:81) [jboss-as-weld-7.0.2.Final.jar:7.0.2.Final]
                                    at org.jboss.as.weld.services.WeldService.start(WeldService.java:89) [jboss-as-weld-7.0.2.Final.jar:7.0.2.Final]
                                    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)
                                    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)
                                    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_21]
                                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_21]
                                    at java.lang.Thread.run(Thread.java:619) [:1.6.0_21]
                          Caused by: java.lang.ClassNotFoundException: com.ericsson.oss.one.platform.cache.GemFireCacheManager from [Module "deployment.pci-ear-0.0.1-SNAPSHOT.ear.service-bus-gemfire-0.0.1-SNAPSHOT.jar:main" from Service Module Loader]
                                    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191)
                                    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:361)
                                    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:310)
                                    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:103)
                                    at org.jboss.as.weld.WeldModuleResourceLoader.classForName(WeldModuleResourceLoader.java:68) [jboss-as-weld-7.0.2.Final.jar:7.0.2.Final]
                                    ... 11 more
                          
                          
                          17:39:00,922 DEBUG [org.jboss.weld.ClassLoading] (MSC service thread 1-3) WELD-000119 Not generating any bean definitions from com.ericsson.oss.one.platform.cache.GemFireCache because of underlying class loading error
                          17:39:00,923 DEBUG [org.jboss.weld.ClassLoading] (MSC service thread 1-3) catching: org.jboss.weld.resources.spi.ResourceLoadingException: java.lang.ClassNotFoundException: com.ericsson.oss.one.platform.cache.GemFireCache from [Module "deployment.pci-ear-0.0.1-SNAPSHOT.ear.service-bus-gemfire-0.0.1-SNAPSHOT.jar:main" from Service Module Loader]
                                    at org.jboss.as.weld.WeldModuleResourceLoader.classForName(WeldModuleResourceLoader.java:74) [jboss-as-weld-7.0.2.Final.jar:7.0.2.Final]
                                    at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:82) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:134) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:191) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:368) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:81) [jboss-as-weld-7.0.2.Final.jar:7.0.2.Final]
                                    at org.jboss.as.weld.services.WeldService.start(WeldService.java:89) [jboss-as-weld-7.0.2.Final.jar:7.0.2.Final]
                                    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)
                                    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)
                                    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_21]
                                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_21]
                                    at java.lang.Thread.run(Thread.java:619) [:1.6.0_21]
                          Caused by: java.lang.ClassNotFoundException: com.ericsson.oss.one.platform.cache.GemFireCache from [Module "deployment.pci-ear-0.0.1-SNAPSHOT.ear.service-bus-gemfire-0.0.1-SNAPSHOT.jar:main" from Service Module Loader]
                                    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191)
                                    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:361)
                                    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:310)
                                    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:103)
                                    at org.jboss.as.weld.WeldModuleResourceLoader.classForName(WeldModuleResourceLoader.java:68) [jboss-as-weld-7.0.2.Final.jar:7.0.2.Final]
                                    ... 11 more
                          
                          
                          17:39:00,955 FINE  [org.jboss.resteasy.cdi.ResteasyCdiExtension] (MSC service thread 1-3) Bean class com.ericsson.oss.one.pci.services.CellDataServiceBean is a SLSB or Singleton. Leaving scope unmodified.
                          17:39:01,580 INFO  [org.jboss.seam.solder.core.CoreExtension] (MSC service thread 1-3) Preventing class org.jboss.seam.solder.core.VersionLoggerUtil from being installed as bean due to @Veto annotation
                          17:39:01,734 DEBUG [org.jboss.weld.ClassLoading] (MSC service thread 1-3) WELD-000119 Not generating any bean definitions from org.jboss.logging.Log4jLogger because of underlying class loading error
                          17:39:01,734 DEBUG [org.jboss.weld.ClassLoading] (MSC service thread 1-3) catching: org.jboss.weld.resources.spi.ResourceLoadingException: Error loading class org.jboss.logging.Log4jLogger
                                    at org.jboss.weld.resources.ClassTransformer.loadClass(ClassTransformer.java:189) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:95) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:134) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:191) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:368) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:81) [jboss-as-weld-7.0.2.Final.jar:7.0.2.Final]
                                    at org.jboss.as.weld.services.WeldService.start(WeldService.java:89) [jboss-as-weld-7.0.2.Final.jar:7.0.2.Final]
                                    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)
                                    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)
                                    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_21]
                                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_21]
                                    at java.lang.Thread.run(Thread.java:619) [:1.6.0_21]
                          Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Priority
                                    at java.lang.Class.getDeclaredFields0(Native Method) [:1.6.0_21]
                                    at java.lang.Class.privateGetDeclaredFields(Class.java:2291) [:1.6.0_21]
                                    at java.lang.Class.getDeclaredFields(Class.java:1743) [:1.6.0_21]
                                    at org.jboss.weld.util.reflection.SecureReflections$4.work(SecureReflections.java:116) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.util.reflection.SecureReflections$4.work(SecureReflections.java:112) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.util.reflection.SecureReflectionAccess.runAndWrap(SecureReflectionAccess.java:67) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.util.reflection.SecureReflections.getDeclaredFields(SecureReflections.java:111) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.introspector.jlr.WeldClassImpl.<init>(WeldClassImpl.java:145) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.introspector.jlr.WeldClassImpl.of(WeldClassImpl.java:98) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.resources.ClassTransformer$TransformTypeToWeldClass.apply(ClassTransformer.java:54) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.resources.ClassTransformer$TransformTypeToWeldClass.apply(ClassTransformer.java:42) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at com.google.common.collect.ComputingConcurrentHashMap.compute(ComputingConcurrentHashMap.java:206)
                                    at com.google.common.collect.ComputingConcurrentHashMap.apply(ComputingConcurrentHashMap.java:100)
                                    at com.google.common.collect.MapMaker$ComputingMapAdapter.get(MapMaker.java:515)
                                    at org.jboss.weld.resources.ClassTransformer.loadClass(ClassTransformer.java:183) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    ... 11 more
                          Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Priority from [Module "org.jboss.logging:main" from local module loader @15fc40c (roots: C:\java\jboss-as-7.0.2.Final\modules)]
                                    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191)
                                    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:361)
                                    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:333)
                                    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:310)
                                    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:103)
                                    ... 27 more
                          
                          
                          17:39:01,845 INFO  [org.jboss.seam.solder.core.CoreExtension] (MSC service thread 1-3) Preventing class org.jboss.seam.solder.resourceLoader.ResourceProvider from being installed as bean due to @Veto annotation
                          17:39:01,916 DEBUG [org.jboss.weld.ClassLoading] (MSC service thread 1-3) WELD-000119 Not generating any bean definitions from org.jboss.logging.Slf4jLogger because of underlying class loading error
                          17:39:01,916 DEBUG [org.jboss.weld.ClassLoading] (MSC service thread 1-3) catching: org.jboss.weld.resources.spi.ResourceLoadingException: Error loading class org.jboss.logging.Slf4jLogger
                                    at org.jboss.weld.resources.ClassTransformer.loadClass(ClassTransformer.java:189) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:95) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:134) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:191) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:368) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:81) [jboss-as-weld-7.0.2.Final.jar:7.0.2.Final]
                                    at org.jboss.as.weld.services.WeldService.start(WeldService.java:89) [jboss-as-weld-7.0.2.Final.jar:7.0.2.Final]
                                    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)
                                    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)
                                    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_21]
                                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_21]
                                    at java.lang.Thread.run(Thread.java:619) [:1.6.0_21]
                          Caused by: java.lang.NoClassDefFoundError: Lorg/slf4j/Logger;
                                    at java.lang.Class.getDeclaredFields0(Native Method) [:1.6.0_21]
                                    at java.lang.Class.privateGetDeclaredFields(Class.java:2291) [:1.6.0_21]
                                    at java.lang.Class.getDeclaredFields(Class.java:1743) [:1.6.0_21]
                                    at org.jboss.weld.util.reflection.SecureReflections$4.work(SecureReflections.java:116) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.util.reflection.SecureReflections$4.work(SecureReflections.java:112) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.util.reflection.SecureReflectionAccess.runAndWrap(SecureReflectionAccess.java:67) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.util.reflection.SecureReflections.getDeclaredFields(SecureReflections.java:111) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.introspector.jlr.WeldClassImpl.<init>(WeldClassImpl.java:145) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.introspector.jlr.WeldClassImpl.of(WeldClassImpl.java:98) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.resources.ClassTransformer$TransformTypeToWeldClass.apply(ClassTransformer.java:54) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.resources.ClassTransformer$TransformTypeToWeldClass.apply(ClassTransformer.java:42) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at com.google.common.collect.ComputingConcurrentHashMap.compute(ComputingConcurrentHashMap.java:206)
                                    at com.google.common.collect.ComputingConcurrentHashMap.apply(ComputingConcurrentHashMap.java:100)
                                    at com.google.common.collect.MapMaker$ComputingMapAdapter.get(MapMaker.java:515)
                                    at org.jboss.weld.resources.ClassTransformer.loadClass(ClassTransformer.java:183) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    ... 11 more
                          Caused by: java.lang.ClassNotFoundException: org.slf4j.Logger from [Module "org.jboss.logging:main" from local module loader @15fc40c (roots: C:\java\jboss-as-7.0.2.Final\modules)]
                                    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191)
                                    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:361)
                                    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:333)
                                    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:310)
                                    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:103)
                                    ... 27 more
                          
                          
                          17:39:01,927 DEBUG [org.jboss.weld.ClassLoading] (MSC service thread 1-3) WELD-000119 Not generating any bean definitions from org.jboss.logging.Slf4jLocationAwareLogger because of underlying class loading error
                          17:39:01,927 DEBUG [org.jboss.weld.ClassLoading] (MSC service thread 1-3) catching: org.jboss.weld.resources.spi.ResourceLoadingException: Error loading class org.jboss.logging.Slf4jLocationAwareLogger
                                    at org.jboss.weld.resources.ClassTransformer.loadClass(ClassTransformer.java:189) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:95) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:134) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:191) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:368) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:81) [jboss-as-weld-7.0.2.Final.jar:7.0.2.Final]
                                    at org.jboss.as.weld.services.WeldService.start(WeldService.java:89) [jboss-as-weld-7.0.2.Final.jar:7.0.2.Final]
                                    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)
                                    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)
                                    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_21]
                                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_21]
                                    at java.lang.Thread.run(Thread.java:619) [:1.6.0_21]
                          Caused by: java.lang.NoClassDefFoundError: Lorg/slf4j/spi/LocationAwareLogger;
                                    at java.lang.Class.getDeclaredFields0(Native Method) [:1.6.0_21]
                                    at java.lang.Class.privateGetDeclaredFields(Class.java:2291) [:1.6.0_21]
                                    at java.lang.Class.getDeclaredFields(Class.java:1743) [:1.6.0_21]
                                    at org.jboss.weld.util.reflection.SecureReflections$4.work(SecureReflections.java:116) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.util.reflection.SecureReflections$4.work(SecureReflections.java:112) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.util.reflection.SecureReflectionAccess.runAndWrap(SecureReflectionAccess.java:67) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.util.reflection.SecureReflections.getDeclaredFields(SecureReflections.java:111) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.introspector.jlr.WeldClassImpl.<init>(WeldClassImpl.java:145) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.introspector.jlr.WeldClassImpl.of(WeldClassImpl.java:98) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.resources.ClassTransformer$TransformTypeToWeldClass.apply(ClassTransformer.java:54) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at org.jboss.weld.resources.ClassTransformer$TransformTypeToWeldClass.apply(ClassTransformer.java:42) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    at com.google.common.collect.ComputingConcurrentHashMap.compute(ComputingConcurrentHashMap.java:206)
                                    at com.google.common.collect.ComputingConcurrentHashMap.apply(ComputingConcurrentHashMap.java:100)
                                    at com.google.common.collect.MapMaker$ComputingMapAdapter.get(MapMaker.java:515)
                                    at org.jboss.weld.resources.ClassTransformer.loadClass(ClassTransformer.java:183) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                                    ... 11 more
                          Caused by: java.lang.ClassNotFoundException: org.slf4j.spi.LocationAwareLogger from [Module "org.jboss.logging:main" from local module loader @15fc40c (roots: C:\java\jboss-as-7.0.2.Final\modules)]
                                    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191)
                                    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:361)
                                    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:333)
                                    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:310)
                                    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:103)
                          
                          
                          • 10. Re: Help with classloading
                            jaikiran

                            Hi, I've moved back to war deployment as it works now.

                             

                            I tried to revert to the ear file, but seems that I can't get the same error now, probably some mistake.

                            So I guess the issue is resolved now? And it was probably due to some packaging issue?

                            • 11. Re: Help with classloading
                              viniciuscarvalho

                              Oh no, the issue is there. We can't get it to work with EAR deployment. Moved to war just because I need to keep thing rolling here.

                               

                              What I meant by that is that, the original error I had some exceptions on LinkageErrors. For some reason they disapear. But the error persists, It cant find classes that are on the lib folder of the EAR. No matter what I do (meta-inf classpath entries, jboss-deployment-structure) nothing works.

                               

                              Regards