tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Katya Todorova (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (TOMEE-2055) NPE when @AroundConstruct Interceptor is defined on EJB
Date Thu, 08 Jun 2017 14:32:18 GMT

    [ https://issues.apache.org/jira/browse/TOMEE-2055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16042771#comment-16042771
] 

Katya Todorova commented on TOMEE-2055:
---------------------------------------

Romain, thank you for looking into this. My test app still throws NPE, it's in fact the code
that is creating the "produce" object which is causing it:
{code} final T produce = super.produce(super.createInterceptorInstances(ccImpl), ccImpl);
{code}
And as far as I can see from you fix, the null check is done after the produce invocation.
Checking the result for null may fix another scenario, but in my case the new code that is
responsible for creating the interceptor instances is not invoked. 

When super.produce is invoked, should the interceptor instances be already created in all
cases? 



> NPE when @AroundConstruct Interceptor is defined on EJB
> -------------------------------------------------------
>
>                 Key: TOMEE-2055
>                 URL: https://issues.apache.org/jira/browse/TOMEE-2055
>             Project: TomEE
>          Issue Type: Bug
>          Components: TomEE Core Server
>    Affects Versions: 7.0.3
>            Reporter: Katya Todorova
>            Assignee: Romain Manni-Bucau
>             Fix For: 7.0.4
>
>         Attachments: interceptors-example-fail.war
>
>
> 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)
>  



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message