Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2594

Message Driven Bean's around invoke interceptor invoked twice

    Details

    • Steps to Reproduce:
      Hide

      https://github.com/pdudits/javaee7-samples/tree/mdb-interception

      Run run mvn -pl :jms-send-receive clean install -Dtest=AsyncTest with profile either -P wildfly-remote (and have WF running in standalone-full mode) or -P payara-remote (when Payara is running in its default config).

      WildFly is not using WeldManager.createInjectionTarget(EjbDescriptor) to initialize the MDB, therefore it is not affected.

      Show
      https://github.com/pdudits/javaee7-samples/tree/mdb-interception Run run mvn -pl :jms-send-receive clean install -Dtest=AsyncTest with profile either -P wildfly-remote (and have WF running in standalone-full mode) or -P payara-remote (when Payara is running in its default config). WildFly is not using WeldManager.createInjectionTarget(EjbDescriptor) to initialize the MDB, therefore it is not affected.

      Description

      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."

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  pdudits Patrik Duditš
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: