3 Replies Latest reply on Jan 12, 2011 3:57 PM by andreas_back

    MDB: Runtime exceptions do not increase delivery counter, is this a bug?

    kristjan.steinar

      I am using JBoss 6.0.0.20101110-CR1 with HornetQ Server version 2.1.2.Final.

       

      When a runtime exception occurs in the onMessage method, the delivery counter is not updated and the message is never moved to the DLQ.

      This causes the server to try to deliver the message until the consuming application is undeployed and the failed message can be removed from the queue by management tools.

       

      Is this a bug?

       

      The MDB code that causes runtime exceptions

      @MessageDriven(

          activationConfig = {

              @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),

              @ActivationConfigProperty(propertyName="destination", propertyValue="/queue/jb.itu.tes.jms.test.queue.a")

          }

      )

      @TransactionManagement(value = TransactionManagementType.CONTAINER)

      @TransactionAttribute(TransactionAttributeType.REQUIRED)

      public class TestJMS implements MessageListener {

          Logger logger = LoggerFactory.getLogger(TestJMS.class);

       

          @Resource

          private MessageDrivenContext ctx;

       

          public TestJMS() {
              // TODO Auto-generated constructor stub
          }
         
          /**
           * @see MessageListener#onMessage(Message)
           */
          @Override
          public void onMessage(Message message) {
              throw new NullPointerException();
          }

       

       

      The exception

      10:23:07,471 ERROR [org.jboss.ejb3.tx2.impl.CMTTxInterceptor] javax.ejb.EJBTransactionRolledbackException
      10:23:07,471 ERROR [org.hornetq.ra.inflow.HornetQMessageHandler] Failed to deliver message: javax.ejb.EJBTransactionRolledbackException
          at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.handleInCallerTx(CMTTxInterceptor.java:148) [:0.0.1]
          at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:227) [:0.0.1]
          at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.required(CMTTxInterceptor.java:353) [:0.0.1]
          at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invoke(CMTTxInterceptor.java:209) [:0.0.1]
          at org.jboss.ejb3.tx2.aop.CMTTxInterceptorWrapper.invoke(CMTTxInterceptorWrapper.java:52) [:0.0.1]
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3]
          at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42) [:1.0.3]
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3]
          at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:79) [:1.6.3]
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3]
          at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67) [:1.6.3]
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3]
          at org.jboss.ejb3.core.context.CurrentInvocationContextInterceptor.invoke(CurrentInvocationContextInterceptor.java:47) [:1.6.3]
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3]
          at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67) [:1.0.1]
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3]
          at org.jboss.ejb3.interceptor.EJB3TCCLInterceptor.invoke(EJB3TCCLInterceptor.java:86) [:1.6.3]
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.Alpha3]
          at org.jboss.ejb3.mdb.MessagingContainer.localInvoke(MessagingContainer.java:280) [:1.6.3]
          at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.delivery(MessageInflowLocalProxy.java:299) [:1.6.3]
          at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.invoke(MessageInflowLocalProxy.java:152) [:1.6.3]
          at $Proxy140.onMessage(Unknown Source)    at org.hornetq.ra.inflow.HornetQMessageHandler.onMessage(HornetQMessageHandler.java:256) [:6.0.0.20101110-CR1]
          at org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:822) [:6.0.0.20101110-CR1]
          at org.hornetq.core.client.impl.ClientConsumerImpl.access$100(ClientConsumerImpl.java:46) [:6.0.0.20101110-CR1]
          at org.hornetq.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:940) [:6.0.0.20101110-CR1]
          at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:100) [:6.0.0.20101110-CR1]
          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_23]
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_23]
          at java.lang.Thread.run(Thread.java:662) [:1.6.0_23]
      Caused by: java.lang.NullPointerException
          at is.krusty.TestJMS.onMessage(TestJMS.java:47) [:]