Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-6545

@RequestScoped producer method causes NoClassDefFoundError on an implicit dependency during injection

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • 7.1.1.Final
    • CDI / Weld
    • None
    • Workaround Exists
    • Hide
      • In the the module of the "offending" class, add an explicit dependency towards the javax.api module
        OR
      • don't use @RequestScoped
      Show
      In the the module of the "offending" class, add an explicit dependency towards the javax.api module OR don't use @RequestScoped

      When using 2 POJOs: a Producer and a Consumer (see attached), where the producer has a @RequestScoped @Produces method, the following exception occurs:

      java.lang.RuntimeException: Could not inject members
      	at org.jboss.arquillian.testenricher.cdi.CDIInjectionEnricher.injectClass(CDIInjectionEnricher.java:135)
      	at org.jboss.arquillian.testenricher.cdi.CDIInjectionEnricher.enrich(CDIInjectionEnricher.java:78)
      	at org.jboss.arquillian.test.impl.TestInstanceEnricher.enrich(TestInstanceEnricher.java:52)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
      	at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
      	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
      	at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:89)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
      	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
      	at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:75)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
      	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
      	at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:60)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
      	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
      	at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
      	at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
      	at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.before(EventTestRunnerAdaptor.java:95)
      	at org.jboss.arquillian.junit.Arquillian$4.evaluate(Arquillian.java:222)
      	at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314)
      	at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)
      	at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:240)
      	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
      	at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:185)
      	at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314)
      	at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)
      	at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:199)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
      	at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:147)
      	at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
      	at org.junit.runner.JUnitCore.run(JUnitCore.java:136)
      	at org.jboss.arquillian.junit.container.JUnitTestRunner.execute(JUnitTestRunner.java:65)
      	at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.executeTest(ServletTestRunner.java:160)
      	at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.execute(ServletTestRunner.java:126)
      	at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.doGet(ServletTestRunner.java:90)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
      	at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
      	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
      	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
      	at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
      	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
      	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
      	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
      	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
      	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
      	at java.lang.Thread.run(Thread.java:662)
      Caused by: com.google.common.collect.ComputationException: java.lang.NoClassDefFoundError: org/xml/sax/ContentHandler
      	at com.google.common.collect.ComputingConcurrentHashMap$ComputingMapAdapter.get(ComputingConcurrentHashMap.java:397)
      	at org.jboss.weld.bean.proxy.ClientProxyProvider.getClientProxy(ClientProxyProvider.java:102)
      	at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:611)
      	at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:681)
      	at org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:118)
      	at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:703)
      	at org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:712)
      	at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1$1.proceed(ManagedBean.java:161)
      	at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48)
      	at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1.work(ManagedBean.java:157)
      	at org.jboss.weld.bean.ManagedBean$FixInjectionPoint.run(ManagedBean.java:131)
      	at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget.inject(ManagedBean.java:153)
      	at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:290)
      	at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:61)
      	at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:616)
      	at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:681)
      	at org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:118)
      	at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:703)
      	at org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:712)
      	at org.jboss.weld.manager.SimpleInjectionTarget$1.proceed(SimpleInjectionTarget.java:106)
      	at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48)
      	at org.jboss.weld.manager.SimpleInjectionTarget.inject(SimpleInjectionTarget.java:102)
      	at org.jboss.arquillian.testenricher.cdi.CDIInjectionEnricher.injectNonContextualInstance(CDIInjectionEnricher.java:145)
      	at org.jboss.arquillian.testenricher.cdi.CDIInjectionEnricher.injectClass(CDIInjectionEnricher.java:125)
      	... 75 more
      Caused by: java.lang.NoClassDefFoundError: org/xml/sax/ContentHandler
      	at java.lang.Class.getDeclaredMethods0(Native Method)
      	at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
      	at java.lang.Class.privateGetPublicMethods(Class.java:2547)
      	at java.lang.Class.getMethods(Class.java:1410)
      	at org.jboss.weld.bean.proxy.ProxyFactory.addMethodsFromClass(ProxyFactory.java:480)
      	at org.jboss.weld.bean.proxy.ProxyFactory.addMethods(ProxyFactory.java:432)
      	at org.jboss.weld.bean.proxy.ProxyFactory.createProxyClass(ProxyFactory.java:363)
      	at org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:273)
      	at org.jboss.weld.bean.proxy.ProxyFactory.create(ProxyFactory.java:235)
      	at org.jboss.weld.bean.proxy.ClientProxyProvider.createClientProxy(ClientProxyProvider.java:87)
      	at org.jboss.weld.bean.proxy.ClientProxyProvider.access$000(ClientProxyProvider.java:43)
      	at org.jboss.weld.bean.proxy.ClientProxyProvider$1.apply(ClientProxyProvider.java:53)
      	at org.jboss.weld.bean.proxy.ClientProxyProvider$1.apply(ClientProxyProvider.java:46)
      	at com.google.common.collect.ComputingConcurrentHashMap$ComputingValueReference.compute(ComputingConcurrentHashMap.java:355)
      	at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.compute(ComputingConcurrentHashMap.java:184)
      	at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.getOrCompute(ComputingConcurrentHashMap.java:153)
      	at com.google.common.collect.ComputingConcurrentHashMap.getOrCompute(ComputingConcurrentHashMap.java:69)
      	at com.google.common.collect.ComputingConcurrentHashMap$ComputingMapAdapter.get(ComputingConcurrentHashMap.java:393)
      	... 98 more
      Caused by: java.lang.ClassNotFoundException: org.xml.sax.ContentHandler from [Module "javax.jcr:main" from local module loader @7eb1cc87 (roots: D:\Work\hchiorean.modeshape\integration\modeshape-jbossas-integration-tests\target\jboss-as-7.1.1.Final\modules)]
      	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)
      	... 116 more
      

      while org.xml.sax.ContentHandler is defined in the javax.api module and should be, according to this: https://docs.jboss.org/author/display/AS7/Implicit+module+dependencies+for+deployments an implicit dependency.

      The runtime environment/context is ModeShape's AS 7.1.1 kit overlayed in the container and an Arquillian based test (attached as well). The problem can be reproduced either with a WAR file or an EAR file, using various structures.

      The attached zip contains the 3 classes used to reproduce the issue and are part of ModeShape's integration test module: https://github.com/ModeShape/modeshape/tree/master/integration/modeshape-jbossas-integration-tests

              sdouglas1@redhat.com Stuart Douglas (Inactive)
              hchiorean Horia Chiorean (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: