[ 
https://issues.apache.org/jira/browse/OWB-423?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mark Struberg updated OWB-423:
------------------------------

    Fix Version/s:     (was: 1.1.0)
                   1.2.0

moved to target-1.2.0

> OpenWebBeansEjbInterceptor is LATE in establishing the request context for an 
> EJB
> ---------------------------------------------------------------------------------
>
>                 Key: OWB-423
>                 URL: https://issues.apache.org/jira/browse/OWB-423
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Java EE Integration
>    Affects Versions: 1.1.0, 1.0.0, 1.0.0-alpha-2, 1.0.0-alpha-1, M4, M3, M2, 
> M1
>         Environment: Win2003 Server
>            Reporter: Rohit Dilip Kelapure
>            Assignee: Gurkan Erdogdu
>             Fix For: 1.2.0
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> The CDI specification in 6.7.1. Request context lifecycle states that the  
> request scope is active during any remote method invocation of any EJB, 
> during any asynchronous method invocation of any EJB, during any call to an 
> EJB timeout method and during message delivery to any EJB message-driven 
> bean, and during any message delivery to a MessageListener for a JMS topic or 
> queue obtained from the Java EE component environment.
> Currently  the OpenWebBeansEjbInterceptor  does two broad things
> - activate and deactive request and application contexts
> - call OWB Interceptors and decorators applicable to the EJB
> This doesn't work correctly if a request scoped bean is injected in an old 
> style JEE5 EJB interceptor. According to the spec. the old EJB interceptors 
> run before the JSR299 interceptors and decorators. However there is no 
> request scope when a CDI injection occurs in the EJB interceptor because the 
> request scope is established LATER by the OpenWebBeansEjbInterceptor   after 
> all the EJB interceptors have run.
> This results in an exception like this ..
> javax.ejb.EJBException: Injection failure; nested exception is: 
> javax.enterprise.context.ContextNotActiveException: WebBeans context with 
> scope type annotation @RequestScoped does not exist within current thread
> Caused by: javax.enterprise.context.ContextNotActiveException: WebBeans 
> context with scope type annotation @RequestScoped does not exist within 
> current thread
>       at 
> org.apache.webbeans.container.BeanManagerImpl.getContext(BeanManagerImpl.java:309)
>       at 
> org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.getContextualInstance(NormalScopedBeanInterceptorHandler.java:123)
>       at 
> org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.invoke(NormalScopedBeanInterceptorHandler.java:94)
>       at 
> com.ibm.ws.fat.jcdi.beans.CurrentUser_$$_javassist_4.toString(CurrentUser_$$_javassist_4.java)
> The solution to this problem is to take a sandwich approach to configuring 
> interceptors.  i.e Split OpenWebBeansEjbInterceptor   into two
>  FirstEJBInterceptor ....  establishes and tears down OWB request and 
> application context
>  EJB Interceptor-1
>  EJB Interceptor- 2
>  OpenWebBeansEjbInterceptor ..  setsup the JCDI runtime to call OWB 
> Interceptors and decorators applicable to the EJB
>  OWB Interceptor-1
>  OWB decorator
> The FirstEJBInterceptor is responsible  for ensuring the request context is 
> active during requests to EJBs and has to be innermost or the first 
> interceptor in the stack for all EJBs. Without this interceptor Apache OWB 
> cannot do injection of request scoped or application scoped beans in the 
> older JEE5 EJB Interceptors. 
> --Thank You

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to