[
https://issues.jboss.org/browse/AS7-5489?page=com.atlassian.jira.plugin.s...
]
Stuart Douglas resolved AS7-5489.
---------------------------------
Resolution: Done
As far as I can see I think this is already done.
I think I left it open because I wanted to investigate something further, but I can't
remember exactly what it was, and looking at the code it should not be a problem as far as
I can see.
Resource injection fails for bound JNDI References
--------------------------------------------------
Key: AS7-5489
URL:
https://issues.jboss.org/browse/AS7-5489
Project: Application Server 7
Issue Type: Bug
Components: CDI / Weld, EJB
Environment: Current AS7 master (5da40038a409abdb0492b7198b5073379223fb08)
AS 7.1.3.Beta1
Reporter: Jozef Hartinger
Assignee: Stuart Douglas
AS7 seems to be inconsistent when a Reference (e.g. ModularReference) is bound to JNDI.
Since
https://github.com/jbossas/jboss-as/commit/2b0130ca72fd4bbcb9339fe55dc3e8...
the BeanManager is injected using ModularReference.
When a JNDI lookup is done for "java:comp/BeanManager", my understanding is
that NamingContext
(
https://github.com/jbossas/jboss-as/blob/master/naming/src/main/java/org/...)
takes care of turning the ModularReference instance into a BeanManager instance and
everything works as expected.
However, when instead of a lookup a resource injection is performed on a session bean
such as:
{code:JAVA}
@Stateful
@SessionScoped
public class HelloBean implements IHelloBean, Serializable {
@Resource(mappedName = "java:comp/BeanManager")
private BeanManager beanManager;
@Remove
public void remove() {
}
}
{code}
I am getting the following exception at runtime which indicates the ModularReference is
not turned into BeanManager instance for injection into the field of the session bean.
{code}
15:25:45,359 ERROR [org.jboss.arquillian.protocol.jmx.JMXTestRunner] (pool-3-thread-1)
Failed: org.jboss.weld.tests.enterprise.EnterpriseBeanTest.testPassivationOfEjbs:
org.jboss.weld.exceptions.CreationException: WELD-000079 Could not find the EJB in JNDI:
class org.jboss.weld.tests.enterprise.IHelloBean$587032701$Proxy$_$$_Weld$Proxy$
at org.jboss.weld.bean.SessionBean.create(SessionBean.java:306)
[weld-core-1.1.9.Final.jar:2012-08-06 19:12]
at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:103)
[weld-core-1.1.9.Final.jar:2012-08-06 19:12]
at
org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:90)
[weld-core-1.1.9.Final.jar:2012-08-06 19:12]
at
org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:104)
[weld-core-1.1.9.Final.jar:2012-08-06 19:12]
at
org.jboss.weld.proxies.IHelloBean$587032701$Proxy$_$$_WeldClientProxy.sayHello(IHelloBean$587032701$Proxy$_$$_WeldClientProxy.java)
[weld-core-1.1.9.Final.jar:]
at
org.jboss.weld.tests.enterprise.HelloAction.executeRequest(HelloAction.java:32)
[2d05798d-e3ce-4ca8-b593-84a523961362.jar:]
at
org.jboss.weld.tests.enterprise.EnterpriseBeanTest.testPassivationOfEjbs(EnterpriseBeanTest.java:113)
[2d05798d-e3ce-4ca8-b593-84a523961362.jar:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_31]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[rt.jar:1.6.0_31]
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[rt.jar:1.6.0_31]
at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_31]
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
[arquillian-service:]
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
[arquillian-service:]
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
[arquillian-service:]
at org.jboss.arquillian.junit.Arquillian$6$1.invoke(Arquillian.java:270)
[arquillian-service:]
at
org.jboss.arquillian.container.test.impl.execution.LocalTestExecuter.execute(LocalTestExecuter.java:60)
[arquillian-service:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_31]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[rt.jar:1.6.0_31]
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[rt.jar:1.6.0_31]
at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_31]
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
[arquillian-service:]
at
org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
[arquillian-service:]
at
org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
[arquillian-service:]
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
[arquillian-service:]
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
[arquillian-service:]
at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
[arquillian-service:]
at
org.jboss.arquillian.container.test.impl.execution.ContainerTestExecuter.execute(ContainerTestExecuter.java:38)
[arquillian-service:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_31]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[rt.jar:1.6.0_31]
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[rt.jar:1.6.0_31]
at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_31]
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
[arquillian-service:]
at
org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
[arquillian-service:]
at
org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
[arquillian-service:]
at
org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:89)
[arquillian-service:]
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source) [:1.6.0_31]
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[rt.jar:1.6.0_31]
at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_31]
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
[arquillian-service:]
at
org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
[arquillian-service:]
at
org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:75)
[arquillian-service:]
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source) [:1.6.0_31]
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[rt.jar:1.6.0_31]
at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_31]
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
[arquillian-service:]
at
org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
[arquillian-service:]
at
org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:60)
[arquillian-service:]
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) [:1.6.0_31]
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[rt.jar:1.6.0_31]
at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_31]
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
[arquillian-service:]
at
org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
[arquillian-service:]
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
[arquillian-service:]
at
org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.test(EventTestRunnerAdaptor.java:111)
[arquillian-service:]
at org.jboss.arquillian.junit.Arquillian$6.evaluate(Arquillian.java:263)
[arquillian-service:]
at org.jboss.arquillian.junit.Arquillian$4.evaluate(Arquillian.java:226)
[arquillian-service:]
at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314)
[arquillian-service:]
at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)
[arquillian-service:]
at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:240)
[arquillian-service:]
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
[arquillian-service:]
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
[arquillian-service:]
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
[arquillian-service:]
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
[arquillian-service:]
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
[arquillian-service:]
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
[arquillian-service:]
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
[arquillian-service:]
at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:185)
[arquillian-service:]
at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314)
[arquillian-service:]
at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)
[arquillian-service:]
at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:199)
[arquillian-service:]
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
[arquillian-service:]
at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:147)
[arquillian-service:]
at org.junit.runner.JUnitCore.run(JUnitCore.java:157) [arquillian-service:]
at org.junit.runner.JUnitCore.run(JUnitCore.java:136) [arquillian-service:]
at
org.jboss.arquillian.junit.container.JUnitTestRunner.execute(JUnitTestRunner.java:65)
[arquillian-service:]
at
org.jboss.arquillian.protocol.jmx.JMXTestRunner.runTestMethodInternal(JMXTestRunner.java:128)
[arquillian-service:]
at
org.jboss.arquillian.protocol.jmx.JMXTestRunner.runTestMethod(JMXTestRunner.java:107)
[arquillian-service:]
at
org.jboss.as.arquillian.service.ArquillianService$ExtendedJMXTestRunner.runTestMethod(ArquillianService.java:214)
[arquillian-service:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_31]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[rt.jar:1.6.0_31]
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[rt.jar:1.6.0_31]
at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_31]
at
com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:93)
[rt.jar:1.6.0_31]
at
com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:27)
[rt.jar:1.6.0_31]
at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:208)
[rt.jar:1.6.0_31]
at com.sun.jmx.mbeanserver.PerInterface.invoke(PerInterface.java:120)
[rt.jar:1.6.0_31]
at com.sun.jmx.mbeanserver.MBeanSupport.invoke(MBeanSupport.java:262)
[rt.jar:1.6.0_31]
at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
[rt.jar:1.6.0_31]
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
[rt.jar:1.6.0_31]
at
org.jboss.as.jmx.PluggableMBeanServerImpl$TcclMBeanServer.invoke(PluggableMBeanServerImpl.java:502)
at
org.jboss.as.jmx.PluggableMBeanServerImpl.invoke(PluggableMBeanServerImpl.java:246)
at
org.jboss.remotingjmx.protocol.v1.ServerProxy$InvokeHandler.handle(ServerProxy.java:1034)
at
org.jboss.remotingjmx.protocol.v1.ServerProxy$MessageReciever$1.run(ServerProxy.java:215)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
[rt.jar:1.6.0_31]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
[rt.jar:1.6.0_31]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_31]
Caused by: java.lang.IllegalStateException: JBAS011048: Failed to construct component
instance
at
org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:163)
[jboss-as-ee-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]
at
org.jboss.as.ejb3.component.stateful.StatefulSessionComponent.constructComponentInstance(StatefulSessionComponent.java:145)
[jboss-as-ejb3-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]
at
org.jboss.as.ejb3.component.stateful.StatefulSessionComponent.constructComponentInstance(StatefulSessionComponent.java:76)
[jboss-as-ejb3-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]
at
org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:85)
[jboss-as-ee-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]
at
org.jboss.as.ejb3.component.stateful.StatefulSessionComponent.createInstance(StatefulSessionComponent.java:135)
[jboss-as-ejb3-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]
at
org.jboss.as.ejb3.component.stateful.StatefulSessionComponent.createInstance(StatefulSessionComponent.java:76)
[jboss-as-ejb3-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]
at
org.jboss.as.ejb3.cache.TransactionAwareObjectFactory.createInstance(TransactionAwareObjectFactory.java:53)
[jboss-as-ejb3-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]
at
org.jboss.as.ejb3.cache.impl.backing.NonPassivatingBackingCacheImpl.create(NonPassivatingBackingCacheImpl.java:106)
[jboss-as-ejb3-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]
at
org.jboss.as.ejb3.cache.impl.backing.NonPassivatingBackingCacheImpl.create(NonPassivatingBackingCacheImpl.java:57)
[jboss-as-ejb3-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]
at org.jboss.as.ejb3.cache.spi.impl.AbstractCache.create(AbstractCache.java:53)
[jboss-as-ejb3-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]
at org.jboss.as.ejb3.cache.impl.SimpleCache.create(SimpleCache.java:69)
[jboss-as-ejb3-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]
at org.jboss.as.ejb3.cache.impl.SimpleCache.create(SimpleCache.java:40)
[jboss-as-ejb3-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]
at
org.jboss.as.ejb3.component.stateful.StatefulSessionComponent.createSession(StatefulSessionComponent.java:241)
[jboss-as-ejb3-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]
at
org.jboss.as.weld.ejb.StatefulSessionObjectReferenceImpl.<init>(StatefulSessionObjectReferenceImpl.java:72)
[jboss-as-weld-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]
at
org.jboss.as.weld.services.bootstrap.WeldEjbServices.resolveEjb(WeldEjbServices.java:60)
[jboss-as-weld-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]
at org.jboss.weld.bean.SessionBean.createReference(SessionBean.java:411)
[weld-core-1.1.9.Final.jar:2012-08-06 19:12]
at
org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.<init>(EnterpriseBeanProxyMethodHandler.java:69)
[weld-core-1.1.9.Final.jar:2012-08-06 19:12]
at org.jboss.weld.bean.SessionBean.create(SessionBean.java:296)
[weld-core-1.1.9.Final.jar:2012-08-06 19:12]
... 95 more
Caused by: java.lang.IllegalArgumentException: Can not set
javax.enterprise.inject.spi.BeanManager field
org.jboss.weld.tests.enterprise.HelloBean.beanManager to
org.jboss.as.naming.context.ModularReference
at
sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:146)
[rt.jar:1.6.0_31]
at
sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:150)
[rt.jar:1.6.0_31]
at
sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63)
[rt.jar:1.6.0_31]
at java.lang.reflect.Field.set(Field.java:657) [rt.jar:1.6.0_31]
at
org.jboss.as.ee.component.ManagedReferenceFieldInjectionInterceptorFactory$ManagedReferenceFieldInjectionInterceptor.processInvocation(ManagedReferenceFieldInjectionInterceptorFactory.java:111)
[jboss-as-ee-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ee.component.ManagedReferenceInterceptorFactory$ManagedReferenceInterceptor.processInvocation(ManagedReferenceInterceptorFactory.java:95)
[jboss-as-ee-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
[jboss-as-ee-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.jpa.interceptor.SFSBPreCreateInterceptor.processInvocation(SFSBPreCreateInterceptor.java:47)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
[jboss-as-ejb3-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)
[jboss-as-ee-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
[jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at
org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:161)
[jboss-as-ee-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]
... 112 more
{code}
--
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