[jboss-jira] [JBoss JIRA] (WFLY-2757) CNFE if sub-deployment (WAR in an EAR) depending on a static module with CDI portable extension
Stuart Douglas (JIRA)
issues at jboss.org
Wed Jan 15 09:43:33 EST 2014
[ https://issues.jboss.org/browse/WFLY-2757?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12935935#comment-12935935 ]
Stuart Douglas commented on WFLY-2757:
--------------------------------------
The issue is in how we select the class loader to create the proxy. Normally we use the class loader of the class that is being proxied, however we cannot do that in this case because the class is in a static module, and defining the proxy there would cause a class loader leak (and probably just plain fail to work, depending on if the module has dependencies the proxy needs).
Because we cannot use the static modules class loader instead we always use the class loader of the top level deployment, which in this case is the ears class loader.
We don't really have any way to tell that the Servlet class loader is the class loader that we should be using. Even though it seems obvious in this case, it is possible to get much more complex scenarios where it is not obvious. For example what if your ear has two wars that each have a dependency? We would basically have to pick one at random. Basically any logic we added in this area would just be guessing, and I would rather avoid that.
[~jharting] Do we actually need to create a proxy for an extension? The instance is going to be the same throughout, so I wonder if we could just inject the instance directly. I have a feeling that there is some reason why we can't but I can't remember what that reason is off the top of my head.
> CNFE if sub-deployment (WAR in an EAR) depending on a static module with CDI portable extension
> -----------------------------------------------------------------------------------------------
>
> Key: WFLY-2757
> URL: https://issues.jboss.org/browse/WFLY-2757
> Project: WildFly
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: CDI / Weld
> Affects Versions: 8.0.0.CR1
> Reporter: Marek Schmidt
> Assignee: Stuart Douglas
> Attachments: WFLY-2757.tar
>
>
> Having an EAR with an WAR depending on a CDI portable extension from a static module.
> {code}
> <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
> <!-- uncomment this and it will start to work
> <deployment>
> <dependencies>
> <module name="org.jboss.test.extensionModule" />
> </dependencies>
> </deployment> -->
> <sub-deployment name="test-web.war">
> <dependencies>
> <module name="org.jboss.test.extensionModule" meta-inf="import" services="import"/>
> </dependencies>
> </sub-deployment>
> {code}
> causes an exception when a servlet from the test-web.war is accessed.
> Adding the dependency to static module from the EAR itself (see above) will make this work, but this shouldn't be needed IMHO.
> {quote}
> 13:51:56,069 ERROR [io.undertow.request] (default task-5) UT005023: Exception handling request to /test-web/funny: javax.servlet.ServletException: UT010013: Could not instantiate org.jboss.weld.tests.module.extension.FunnyServlet
> at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:201) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
> at io.undertow.servlet.core.ManagedServlet.getServlet(ManagedServlet.java:147) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
> at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:86) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
> at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
> at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
> at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:70)
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]
> at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
> at io.undertow.security.handlers.AuthenticationCallHandler.handleRequest(AuthenticationCallHandler.java:52) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]
> at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]
> at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
> at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:67) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
> at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:70) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]
> at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]
> at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]
> at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
> at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
> at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
> at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
> at io.undertow.server.Connectors.executeRootHandler(Connectors.java:164) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]
> at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:654) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_45]
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_45]
> at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]
> Caused by: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance
> at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:162)
> at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:133)
> at org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:89)
> at org.jboss.as.ee.component.ComponentRegistry$ComponentManagedReferenceFactory.getReference(ComponentRegistry.java:149)
> at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$5.createInstance(UndertowDeploymentInfoService.java:1099)
> at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:199) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
> ... 25 more
> Caused by: org.jboss.weld.exceptions.WeldException: WELD-001524: Unable to load proxy class for bean Extension [class org.jboss.weld.tests.module.extension.FunExtension] with qualifiers [@Default]; test-web.war with class class org.jboss.weld.tests.module.extension.FunExtension using classloader ModuleClassLoader for Module "deployment.test.ear:main" from Service Module Loader
> at org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:326) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
> at org.jboss.weld.bean.proxy.ProxyFactory.create(ProxyFactory.java:277) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
> at org.jboss.weld.bean.proxy.ClientProxyFactory.create(ClientProxyFactory.java:111) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
> at org.jboss.weld.bean.proxy.ClientProxyProvider.createClientProxy(ClientProxyProvider.java:181) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
> at org.jboss.weld.bean.proxy.ClientProxyProvider.createClientProxy(ClientProxyProvider.java:171) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
> at org.jboss.weld.bean.proxy.ClientProxyProvider.access$100(ClientProxyProvider.java:45) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
> at org.jboss.weld.bean.proxy.ClientProxyProvider$CreateClientProxy.load(ClientProxyProvider.java:56) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
> at org.jboss.weld.bean.proxy.ClientProxyProvider$CreateClientProxy.load(ClientProxyProvider.java:52) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
> at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3522)
> at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2315)
> at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2278)
> at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2193)
> at com.google.common.cache.LocalCache.get(LocalCache.java:3932)
> at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3936)
> at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4806)
> at org.jboss.weld.util.cache.LoadingCacheUtils.getCacheValue(LoadingCacheUtils.java:52) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
> at org.jboss.weld.util.cache.LoadingCacheUtils.getCastCacheValue(LoadingCacheUtils.java:80) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
> at org.jboss.weld.bean.proxy.ClientProxyProvider.getClientProxy(ClientProxyProvider.java:205) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
> at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:727) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
> at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:789) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
> at org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:92) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
> at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:358) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
> at org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:369) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
> at org.jboss.weld.injection.producer.DefaultInjector.inject(DefaultInjector.java:72) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
> at org.jboss.weld.injection.producer.DefaultInjector$1.proceed(DefaultInjector.java:66) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
> at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
> at org.jboss.weld.injection.producer.DefaultInjector.inject(DefaultInjector.java:64) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
> at org.jboss.weld.injection.producer.BasicInjectionTarget.inject(BasicInjectionTarget.java:90) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
> at org.jboss.as.weld.injection.WeldInjectionContext.inject(WeldInjectionContext.java:39) [wildfly-weld-8.0.0.CR1.jar:8.0.0.CR1]
> at org.jboss.as.weld.injection.WeldInjectionInterceptor.processInvocation(WeldInjectionInterceptor.java:51) [wildfly-weld-8.0.0.CR1.jar:8.0.0.CR1]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
> at org.jboss.as.ee.component.AroundConstructInterceptorFactory$1.processInvocation(AroundConstructInterceptorFactory.java:28)
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
> at org.jboss.as.weld.injection.WeldInterceptorInjectionInterceptor.processInvocation(WeldInterceptorInjectionInterceptor.java:56) [wildfly-weld-8.0.0.CR1.jar:8.0.0.CR1]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
> at org.jboss.as.weld.injection.WeldInjectionContextInterceptor.processInvocation(WeldInjectionContextInterceptor.java:43) [wildfly-weld-8.0.0.CR1.jar:8.0.0.CR1]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
> at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45) [wildfly-ee-8.0.0.CR1.jar:8.0.0.CR1]
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
> at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64)
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
> at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:325)
> at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80)
> at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
> at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
> at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:160)
> ... 30 more
> Caused by: java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/jboss/weld/tests/module/extension/FunExtension
> at org.jboss.weld.util.bytecode.ClassFileUtils.toClass(ClassFileUtils.java:101) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
> at org.jboss.weld.bean.proxy.ProxyFactory.createProxyClass(ProxyFactory.java:434) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
> at org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:319) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
> ... 75 more
> Caused by: java.lang.NoClassDefFoundError: org/jboss/weld/tests/module/extension/FunExtension
> at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.7.0_45]
> at java.lang.ClassLoader.defineClass(ClassLoader.java:800) [rt.jar:1.7.0_45]
> at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source) [:1.7.0_45]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_45]
> at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_45]
> at org.jboss.weld.util.bytecode.ClassFileUtils.toClass2(ClassFileUtils.java:108) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
> at org.jboss.weld.util.bytecode.ClassFileUtils.toClass(ClassFileUtils.java:97) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
> ... 77 more
> Caused by: java.lang.ClassNotFoundException: org.jboss.weld.tests.module.extension.FunExtension from [Module "deployment.test.ear:main" from Service Module Loader]
> at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:197) [jboss-modules.jar:1.3.0.Final]
> at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:443) [jboss-modules.jar:1.3.0.Final]
> at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:431) [jboss-modules.jar:1.3.0.Final]
> at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:373) [jboss-modules.jar:1.3.0.Final]
> at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:118) [jboss-modules.jar:1.3.0.Final]
> ... 84 more
> {quote}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list