1 Reply Latest reply on Oct 31, 2002 4:12 PM by shashir

    Message is lost during exception in MDB

    shashir

      Hi,

      I have a simple MDB and noticing a problem with messages are not being redelivered and getting lost when an exception is thrown. I tried different options such as NotSupported, Required or RequiresNew but no success. Any clue on what I am missing. I am using JBOSS 3.0.0.

      I have attached the exception stack dump.

      Thanks
      --shashi

      OnMessage code:
      public void onMessage(Message msg)throws EJBException
      {
      try
      {

      System.out.println(" UpdateJobStatusBean OnMessage()");
      MapMessage message = (MapMessage)msg;
      String jobid = new String(message.getString("jobid"));
      String statusid = new String(message.getString("statusid"));
      System.out.println("UpdateJobStatusBean Bean : jobid, statusid are = " + jobid + "," +statusid );
      throw new PrintMeProException("This is test exception. This will send the message back to the queue");
      } catch (JMSException jmse) {
      throw new EJBException(jmse.getMessage() );
      }
      catch (Exception e)
      {
      throw new EJBException(e.getMessage() );
      }
      }
      EJB-JAR.XML:
      <ejb-jar>
      <enterprise-beans>

      <message-driven>

      <ejb-name>UpdateJobStatusMDB</ejb-name>
      <ejb-class>com.efi.apps.flypaper.listeners.mdb.UpdateJobStatusBean</ejb-class>
      <transaction-type>Container</transaction-type>
      <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
      <message-driven-destination>
      <destination-type>javax.jms.Queue</destination-type>
      </message-driven-destination>

      </message-driven>

      <assembly-descriptor>
      <container-transaction>

      <ejb-name>UpdateJobStatusMDB</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      </assembly-descriptor>
      </enterprise-beans>
      </ejb-jar>

        • 1. Re: Message is lost during exception in MDB
          shashir

          Here is the exception trace.

          Thanks
          --shashi

          15:15:32,380 ERROR [LogInterceptor] TransactionRolledbackException, causedBy:
          javax.ejb.EJBException: This is test exception. This will send the message back to the queue
          at com.efi.apps.flypaper.listeners.mdb.UpdateJobStatusBean.onMessage(UpdateJobStatusBean.java:75)
          at java.lang.reflect.Method.invoke(Native Method)
          at org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:391)
          at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)

          at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:88)
          at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:96)
          at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:142)
          at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:61)
          at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:100)
          at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:166)
          at org.jboss.ejb.MessageDrivenContainer.invoke(MessageDrivenContainer.java:302)
          at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:625)
          at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:973)
          at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:234)
          at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:561)
          at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:377)
          at org.jboss.mq.SpySession.run(SpySession.java:252)
          at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:173)
          at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:642)
          at java.lang.Thread.run(Thread.java:484)
          15:15:32,580 ERROR [JMSContainerInvoker] Exception in JMSCI message listener
          javax.transaction.TransactionRolledbackException: This is test exception. This will send the message back to the queue;
          nested exception is:
          javax.ejb.EJBException: This is test exception. This will send the message back to the queue
          javax.ejb.EJBException: This is test exception. This will send the message back to the queue
          at com.efi.apps.flypaper.listeners.mdb.UpdateJobStatusBean.onMessage(UpdateJobStatusBean.java:75)
          at java.lang.reflect.Method.invoke(Native Method)
          at org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:391)
          at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)

          at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:88)
          at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:96)
          at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:142)
          at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:61)
          at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:100)
          at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:166)
          at org.jboss.ejb.MessageDrivenContainer.invoke(MessageDrivenContainer.java:302)
          at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:625)
          at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:973)
          at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:234)
          at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:561)
          at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:377)
          at org.jboss.mq.SpySession.run(SpySession.java:252)
          at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:173)
          at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:642)
          at java.lang.Thread.run(Thread.java:484)