Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
7.0.3
-
None
Description
When @AroundConstruct Interceptor is defined on an EJB, a NPE is thrown (stacktrace below). A test app attached to reproduce the issue. (e.g .request url http://localhost:8080/interceptors-example-fail/TestServlet)
Some observations while debugging the issue:
org.apache.openejb.cdi.CdiEjbBean$EjbInjectionTargetImpl#createNewPojo replies on org.apache.webbeans.portable.AbstractProducer#createInterceptorInstances to create interceptor instances. It seems that org.apache.openejb.BeanContext#mergeOWBAndOpenEJBInfo doesn't fill AbstractProducer#interceptorInfo with ejbInterceptors although they are discovered and stored in the corresponding openejb beanContext.
javax.ejb.NoSuchEJBException: Singleton failed to initialize
org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:210)
org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:69)
org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:120)
org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:118)
java.util.concurrent.FutureTask.run(FutureTask.java:266)
org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:129)
org.apache.openejb.core.singleton.SingletonContainer.invoke(SingletonContainer.java:209)
org.apache.openejb.core.ivm.EjbObjectProxyHandler.synchronizedBusinessMethod(EjbObjectProxyHandler.java:265)
org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(EjbObjectProxyHandler.java:260)
org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectProxyHandler.java:89)
org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:347)
test.TestBean$$LocalBeanProxy.test(test/TestBean.java)
test.TestServlet.doGet(TestServlet.java:35)
javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.apache.openejb.server.httpd.EEFilter.doFilter(EEFilter.java:65)
root cause
java.lang.NullPointerException
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.apache.webbeans.component.InterceptorBean.intercept(InterceptorBean.java:152)
org.apache.webbeans.intercept.InterceptorInvocationContext.proceed(InterceptorInvocationContext.java:63)
org.apache.webbeans.portable.InjectionTargetImpl.produce(InjectionTargetImpl.java:163)
org.apache.openejb.cdi.CdiEjbBean$EjbInjectionTargetImpl.createNewPojo(CdiEjbBean.java:525)
org.apache.openejb.BeanContext.newInstance(BeanContext.java:1595)
org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:179)
org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:69)
org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:120)
org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:118)
java.util.concurrent.FutureTask.run(FutureTask.java:266)
org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:129)
org.apache.openejb.core.singleton.SingletonContainer.invoke(SingletonContainer.java:209)
org.apache.openejb.core.ivm.EjbObjectProxyHandler.synchronizedBusinessMethod(EjbObjectProxyHandler.java:265)
org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(EjbObjectProxyHandler.java:260)
org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectProxyHandler.java:89)
org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:347)
test.TestBean$$LocalBeanProxy.test(test/TestBean.java)
test.TestServlet.doGet(TestServlet.java:35)
javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.apache.openejb.server.httpd.EEFilter.doFilter(EEFilter.java:65)