-
Bug
-
Resolution: Not a Bug
-
Major
-
None
-
3.1.1.Final
-
None
WELD-2404 introduced interception of constructor and method calls for message driven beans. Since then, the MDB's AroundInvoke interceptors are invoked twice, when bean is constructed by means of WeldManager.createInjectionTarget(EjbDescriptor).
Typical stacktrace in this invocation looks like:
java.lang.Exception: Double invocation at org.javaee7.jms.send.receive.mdb.ReceiverInterceptor.increment(ReceiverInterceptor.java:65) // inner interceptor -- superflous ... at org.jboss.weld.interceptor.reader.SimpleInterceptorInvocation$SimpleMethodInvocation.invoke(SimpleInterceptorInvocation.java:73) at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.executeAroundInvoke(InterceptorMethodHandler.java:84) at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.executeInterception(InterceptorMethodHandler.java:72) at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.invoke(InterceptorMethodHandler.java:56) at org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:79) at org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:68) at messageDrivenBean$Proxy$_$$_WeldSubclass.onMessage(Unknown Source) ... EJB container passes to Weld-constructed instance ... at org.javaee7.jms.send.receive.mdb.ReceiverInterceptor.increment(ReceiverInterceptor.java:68) // outer interceptor -- expected ... EJB container interceptor handling ... at org.jboss.weld.module.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:81) at org.jboss.weld.module.ejb.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:52) ... container mdb delivery ... ... resource adapter message inflow ...
Inner invocation context is org.jboss.weld.interceptor.proxy.TerminalAroundInvokeInvocationContext, whereas outer invocation context is EJB Container provided one.
This handling of around invoke appears to be different to one of session beans, where InterceptorApplyingInstantiator is not used, as "The EJB container deals with the other types of interception."