SessionContext injection in a CDI interceptor fails in JBoss EAP 6.3
Issue
- I have an EJB3 that declares a CDI interceptor, this interceptor has a sessionContext field like this :
@Resource
SessionContext sessionContext;
At deployment I get the following exception below. I have also tried @Inject and it fails also.
Caused by: javax.naming.NameNotFoundException: env/com.example.test.ExampleInterceptor/sessionContext -- service jboss.naming.context.java.comp.myejbmodule.myejbmodule.HelloEJB.env."com.example.test.ExampleInterceptor".sessionContext
at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:103)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:197)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:174)
at org.jboss.as.naming.InitialContext$DefaultInitialContext.lookup(InitialContext.java:243)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:183)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:179)
at javax.naming.InitialContext.lookup(InitialContext.java:411) [rt.jar:1.7.0_51]
at javax.naming.InitialContext.lookup(InitialContext.java:411) [rt.jar:1.7.0_51]
at org.jboss.weld.injection.spi.helpers.AbstractResourceServices.resolveResource(AbstractResourceServices.java:47) [weld-spi-1.1.Final-redhat-5.jar:1.1.Final-redhat-5]
... 89 more
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 6.3.0
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.