1 2 Previous Next 20 Replies Latest reply on Jul 12, 2013 1:19 PM by Martin Capote

    MDB endpoint in use

    Rodrigo Neves Newbie

      Hi all,

       

      Currently i'm facing a weird problem. I have an MDB receiving some messages, but from times to times it gives me this exception:

       

      java.lang.IllegalStateException: This message endpoint + HistoricMessageBean is already in use by another thread Thread[Thread-74 (group:HornetQ-client-global-threads-1505282694),5,HornetQ-client-global-threads-1505282694]
          at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.invoke(MessageInflowLocalProxy.java:117)
          at $Proxy1064.beforeDelivery(Unknown Source)
          at org.hornetq.ra.inflow.HornetQMessageHandler.onMessage(HornetQMessageHandler.java:215)
          at org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:767)
          at org.hornetq.core.client.impl.ClientConsumerImpl.access$100(ClientConsumerImpl.java:45)
          at org.hornetq.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:885)
          at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:96)
          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
          at java.lang.Thread.run(Unknown Source)

       

      I don't know the reason because i'm sending some messages exactly the same way, but sometimes it gives me this error and the message is lost! I can't lost messages so what can i do? Why occurs this error? Is there someway to prevent the lose of the message? Some way to resend it, or, some place where i can catch this exception to manually resend the message?

       

      Thanks in advance.

      Cheers,

      igo

        • 1. Re: MDB endpoint in use
          Clebert Suconic Master

          Are you working with Topics?

           

          If that's the case I recently fixed a bug on the Resource Adapter.

           

          As a workaround now you could set MaxSessions = 1.

           

          It is fixed on trunk, and it will be fixed on the next release of HornetQ.

          • 2. Re: MDB endpoint in use
            Rodrigo Neves Newbie

            Hi,

             

            Thank you for your fast response, but no, i am using Queues...Any idea what can be?

             

            Cheers,

            Rodrigo

            • 3. Re: MDB endpoint in use
              Clebert Suconic Master

              As for losing messages you should use proper ack mode / transactions. In case of exception the message should be replayed.

               

               

              As for the exception itself. Are you seeing any other exceptions before that one. Do you think you could provide a testcase showing this behaviour?

               

               

              I'm looking at the resource adapter, and we are properly calling the messageEndpoingFactory.newEndpoint for each session being used.

               

              It would be nice if you could provid a testcase. This could be a bug on EJB3 also.

              1 of 1 people found this helpful
              • 4. Re: MDB endpoint in use
                Rodrigo Neves Newbie

                Hi Clebert,

                 

                Thanks again. Regarding the test case, how could i provide you one? This error happens sometimes, alone, and if i stress the system, i.e, if i send more and more messages in less time to the MDB i get more and more of these ones... How can i catch this exception if it is in the onMessage? I get no trace to a line refering my code

                 

                Cheers,

                Rodrigo

                • 5. Re: MDB endpoint in use
                  Clebert Suconic Master

                  "how could i provide you one?"

                   

                  Read this:

                   

                  http://community.jboss.org/wiki/Howtoreportabugissue

                   

                   

                  In special, I'm looking for a way to replicate your issue.

                   

                  Make a simple EJB3, with the minimal config you're using...  and you could have a simple code that would add messages to the queue.

                   

                  I don't know all the configs and details you have in your MDB.. so a simple program with the minimal way to replicate the issue would help us fix the issue.

                  • 6. Re: MDB endpoint in use
                    Rodrigo Neves Newbie

                    Ok, i'll try to do that as soon as i can! But i can't guarantee that after replication the EJB3 with the minimal configs will have the same problem as far as it is also dependent on the stress of the system...

                     

                    Thanks once again,

                    Rodrigo


                    • 7. Re: MDB endpoint in use
                      Clebert Suconic Master
                      You should be able to send as many messages as you can and replicate the stress scenario you have.
                      • 8. Re: MDB endpoint in use
                        Clebert Suconic Master

                        BTW: you didn't state what version of the application server you're using.

                         

                        For HornetQ.. I'm assuming you're not using any Betas.

                        • 9. Re: MDB endpoint in use
                          Rodrigo Neves Newbie

                          Yes you are right. I am using:

                           

                          jboss-5.1.0.GA

                          HornetQ 2.0.0.GA

                           

                          I forgot mentioning something that can be relevant. You told something about an ack / transaction system to prevent message loss. Currently i have a DLQ system working. If an exception occurs inside the onMessage i don't lost any messages because they are sent to the DLQ. But, with this error i'm having, the messages aren't sent to the DLQ.. They just disappear..! And this occurs randomly, it is not a sistematic situation...

                           

                          Cheers,

                          Rodrigo

                          • 10. Re: MDB endpoint in use
                            Josh Britton Newbie

                            Don't know if this will be at all helpful, but...

                             

                            I used to have the same error message (MDB endpoint in use by another thread).  When I examined the server log carefully, I discovered that the error stemmed from an earlier error where a transaction failed to complete because of an optimistic lock failure.  The thread for that transaction became the thread reported as the "another thread" in the MDB endpoint error message.  When I cleaned up my code to prevent concurrent modification to key data, I ceased to have the MDB endpoint issue.

                            • 11. Re: MDB endpoint in use
                              Clebert Suconic Master

                              It's probably a bug on EJB3 then.. but it would be nice to discover what Exception you were throwing.

                               

                              The HornetQMessageHandler (from the resource adapter) will call the beforeReceive and afterDelivered properly as you can see on the code bellow.

                               

                              there is property on the EJB3 proxy that is set and cleared during beforeReceive and afterDelivery. We are calling it properly, but perhaps some exception at the EJB side could break something at the EJB side despised to what we call here.

                               

                              If someone can provide us a testcase we can verify if this is a bug on the resource adapter or on the EJB3 side.

                               

                              You guys can also check the code here case I'm blind or something ;-) (vvvvvv)

                               

                              It's from HornetQMEssageHandler (as I said earlier)

                               

                                    boolean beforeDelivery = false;
                                    try
                                    {
                                       endpoint.beforeDelivery(HornetQActivation.ONMESSAGE);
                                       beforeDelivery = true;
                                       msg.doBeforeReceive();
                                       message.acknowledge();
                                       ((MessageListener)endpoint).onMessage(msg);
                                       endpoint.afterDelivery();
                                       if (useLocalTx)
                                       {
                                          session.commit();
                                       }
                                    }
                                    catch (Throwable e)
                                    {
                                       HornetQMessageHandler.log.error("Failed to deliver message", e);
                                       // we need to call before/afterDelivery as a pair
                                       if (beforeDelivery)
                                       {
                                          try
                                          {
                                             endpoint.afterDelivery();
                                          }
                                          catch (ResourceException e1)
                                          {
                                             HornetQMessageHandler.log.warn("Unable to call after delivery");
                                          }
                                       }
                                       if (useLocalTx)
                                       {
                                          try
                                          {
                                             session.rollback();
                                          }
                                          catch (HornetQException e1)
                                          {
                                             HornetQMessageHandler.log.warn("Unable to roll local transaction back");
                                          }
                                       }
                                    }
                              • 12. Re: MDB endpoint in use
                                Josh Britton Newbie
                                Your code looks fine to me, but that's not saying much.  I am somewhat of a newbie.  I'm not sure if I can produce a self-contained replication of the issue, but at least I can provide the error stacks I mentioned.

                                Below are two groups of errors.  The first, and by far the largest, details the failed transaction that leads to Thread #508 later 'permanently' locking up an MDB endpoint.  The second, the actual "MDB in use" error, is just one small sample.  From that point forward in the log, such errors occur intermittently, always indicating that Thread #508 is still 'using' an MDB endpoint.  Thread 508 does not cease to lock up the endpoint until I restart JBoss (5.1).

                                Group 1: the Optimistic lock issue, including ejb3 and hornetq handling the failed transaction:

                                2010-02-19 08:04:27,351 ERROR [org.hibernate.event.def.AbstractFlushingEventListener] (Thread-508 (group:HornetQ-client-global-threads-4124467)) Could not synchronize database state with session
                                org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [com.mysite.entities.StudentSession#221664]
                                at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1792)
                                at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2435)
                                at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2335)
                                at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2635)
                                at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:115)
                                at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
                                at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
                                at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:168)
                                at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
                                at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
                                at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)
                                at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:365)
                                at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:504)
                                at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:101)
                                at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:269)
                                at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:89)
                                at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:177)
                                at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1423)
                                at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:137)
                                at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
                                at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.endTransaction(MessageInflowLocalProxy.java:435)
                                at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.finish(MessageInflowLocalProxy.java:314)
                                at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.after(MessageInflowLocalProxy.java:230)
                                at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.invoke(MessageInflowLocalProxy.java:136)
                                at $Proxy180.afterDelivery(Unknown Source)
                                at org.hornetq.ra.inflow.HornetQMessageHandler.onMessage(HornetQMessageHandler.java:220)
                                at org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:767)
                                at org.hornetq.core.client.impl.ClientConsumerImpl.access$100(ClientConsumerImpl.java:45)
                                at org.hornetq.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:885)
                                at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:96)
                                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
                                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
                                at java.lang.Thread.run(Thread.java:619)
                                2010-02-19 08:04:27,360 WARN  [com.arjuna.ats.arjuna.logging.arjLoggerI18N] (Thread-508 (group:HornetQ-client-global-threads-4124467)) [com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator_2] TwoPhaseCoordinator.beforeCompletion - failed for com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple@97aba7
                                javax.persistence.OptimisticLockException: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [com.mysite.entities.StudentSession#221664]
                                at org.hibernate.ejb.AbstractEntityManagerImpl.wrapStaleStateException(AbstractEntityManagerImpl.java:630)
                                at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:588)
                                at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:513)
                                at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:101)
                                at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:269)
                                at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:89)
                                at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:177)
                                at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1423)
                                at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:137)
                                at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
                                at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.endTransaction(MessageInflowLocalProxy.java:435)
                                at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.finish(MessageInflowLocalProxy.java:314)
                                at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.after(MessageInflowLocalProxy.java:230)
                                at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.invoke(MessageInflowLocalProxy.java:136)
                                at $Proxy180.afterDelivery(Unknown Source)
                                at org.hornetq.ra.inflow.HornetQMessageHandler.onMessage(HornetQMessageHandler.java:220)
                                at org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:767)
                                at org.hornetq.core.client.impl.ClientConsumerImpl.access$100(ClientConsumerImpl.java:45)
                                at org.hornetq.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:885)
                                at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:96)
                                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
                                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
                                at java.lang.Thread.run(Thread.java:619)
                                Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [com.mysite.entities.StudentSession#221664]
                                at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1792)
                                at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2435)
                                at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2335)
                                at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2635)
                                at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:115)
                                at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
                                at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
                                at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:168)
                                at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
                                at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
                                at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)
                                at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:365)
                                at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:504)
                                ... 20 more
                                2010-02-19 08:04:27,363 ERROR [org.hornetq.ra.inflow.HornetQMessageHandler] (Thread-508 (group:HornetQ-client-global-threads-4124467)) Failed to deliver message
                                javax.resource.ResourceException: javax.transaction.RollbackException: [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Could not commit transaction.
                                at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.after(MessageInflowLocalProxy.java:234)
                                at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.invoke(MessageInflowLocalProxy.java:136)
                                at $Proxy180.afterDelivery(Unknown Source)
                                at org.hornetq.ra.inflow.HornetQMessageHandler.onMessage(HornetQMessageHandler.java:220)
                                at org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:767)
                                at org.hornetq.core.client.impl.ClientConsumerImpl.access$100(ClientConsumerImpl.java:45)
                                at org.hornetq.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:885)
                                at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:96)
                                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
                                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
                                at java.lang.Thread.run(Thread.java:619)
                                Caused by: javax.transaction.RollbackException: [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Could not commit transaction.
                                at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1435)
                                at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:137)
                                at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
                                at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.endTransaction(MessageInflowLocalProxy.java:435)
                                at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.finish(MessageInflowLocalProxy.java:314)
                                at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.after(MessageInflowLocalProxy.java:230)
                                ... 10 more
                                Caused by: java.lang.Throwable: setRollbackOnly called from:
                                at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.setRollbackOnly(TransactionImple.java:392)
                                at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.setRollbackOnly(BaseTransaction.java:195)
                                at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.setRollbackOnly(BaseTransactionManagerDelegate.java:123)
                                at org.hibernate.ejb.AbstractEntityManagerImpl.markAsRollback(AbstractEntityManagerImpl.java:421)
                                at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:576)
                                at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:589)
                                at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:513)
                                at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:101)
                                at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:269)
                                at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:89)
                                at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:177)
                                at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1423)
                                ... 15 more
                                2010-02-19 08:04:27,363 ERROR [org.hornetq.core.client.impl.ClientConsumerImpl] (Thread-508 (group:HornetQ-client-global-threads-4124467)) Failed to call onMessage()
                                java.lang.IllegalStateException: afterDelivery without a previous beforeDelivery for message endpoint StudentMDB
                                at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.after(MessageInflowLocalProxy.java:225)
                                at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.invoke(MessageInflowLocalProxy.java:136)
                                at $Proxy180.afterDelivery(Unknown Source)
                                at org.hornetq.ra.inflow.HornetQMessageHandler.onMessage(HornetQMessageHandler.java:234)
                                at org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:767)
                                at org.hornetq.core.client.impl.ClientConsumerImpl.access$100(ClientConsumerImpl.java:45)
                                at org.hornetq.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:885)
                                at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:96)
                                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
                                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
                                at java.lang.Thread.run(Thread.java:619)

                                Group 2: a sample of the 'permanent' block Thread 508 then places on an MDB endpoint:

                                2010-02-19 08:04:30,635 ERROR [org.hornetq.ra.inflow.HornetQMessageHandler] (Thread-518 (group:HornetQ-client-global-threads-4124467)) Failed to deliver message
                                java.lang.IllegalStateException: This message endpoint + StudentMDB is already in use by another thread Thread[Thread-508 (group:HornetQ-client-global-threads-4124467),5,HornetQ-client-global-threads-4124467]
                                at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.invoke(MessageInflowLocalProxy.java:117)
                                at $Proxy180.beforeDelivery(Unknown Source)
                                at org.hornetq.ra.inflow.HornetQMessageHandler.onMessage(HornetQMessageHandler.java:215)
                                at org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:767)
                                at org.hornetq.core.client.impl.ClientConsumerImpl.access$100(ClientConsumerImpl.java:45)
                                at org.hornetq.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:885)
                                at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:96)
                                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
                                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
                                at java.lang.Thread.run(Thread.java:619)
                                1 of 1 people found this helpful
                                • 13. Re: MDB endpoint in use
                                  Rodrigo Neves Newbie

                                  Hi Josh,

                                   

                                  After looking carefully to my log it happens the same to me! And i checked the thread number and is also the same thread that fails do execute an update in the database due to concurrent access... Here is an example:

                                   

                                  2010-03-12 14:15:29,868 WARN  [org.hibernate.util.JDBCExceptionReporter] (Thread-47 (group:HornetQ-client-global-threads-1505282694)) SQL Error: 0, SQLState: null
                                  2010-03-12 14:15:29,868 ERROR [org.hibernate.util.JDBCExceptionReporter] (Thread-47 (group:HornetQ-client-global-threads-1505282694)) Batch entry 0 update cp_entity_reference_historic set access_entity_id=-14, activation_date=2010-03-12 12:36:56.615000 +00:00:00, deactivation_date=NULL, reference_historic_id=802, reference_token=774998431, req_activation_date=2010-03-12 12:36:56.521000 +00:00:00, req_deactivation_date=NULL, status=DELETED where ID=1240 was aborted.  Call getNextException to see the cause.
                                  2010-03-12 14:15:29,868 WARN  [org.hibernate.util.JDBCExceptionReporter] (Thread-47 (group:HornetQ-client-global-threads-1505282694)) SQL Error: 0, SQLState: 40001
                                  2010-03-12 14:15:29,868 ERROR [org.hibernate.util.JDBCExceptionReporter] (Thread-47 (group:HornetQ-client-global-threads-1505282694)) ERROR: could not serialize access due to concurrent update
                                  2010-03-12 14:15:29,870 ERROR [org.hibernate.event.def.AbstractFlushingEventListener] (Thread-47 (group:HornetQ-client-global-threads-1505282694)) Could not synchronize database state with session
                                  org.hibernate.exception.LockAcquisitionException: Could not execute JDBC batch update
                                      at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:105)
                                      at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
                                      at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
                                      at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)
                                      at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:168)
                                      at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
                                      at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
                                      at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)
                                      at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:365)
                                      at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:504)
                                      at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:101)
                                      at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:269)
                                      at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:89)
                                      at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:177)
                                      at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1423)
                                      at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:137)
                                      at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
                                      at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.endTransaction(MessageInflowLocalProxy.java:435)
                                      at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.finish(MessageInflowLocalProxy.java:314)
                                      at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.after(MessageInflowLocalProxy.java:230)
                                      at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.invoke(MessageInflowLocalProxy.java:136)
                                      at $Proxy498.afterDelivery(Unknown Source)
                                      at org.hornetq.ra.inflow.HornetQMessageHandler.onMessage(HornetQMessageHandler.java:220)
                                      at org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:767)
                                      at org.hornetq.core.client.impl.ClientConsumerImpl.access$100(ClientConsumerImpl.java:45)
                                      at org.hornetq.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:885)
                                      at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:96)
                                      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
                                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
                                      at java.lang.Thread.run(Unknown Source)

                                   

                                  and....

                                   

                                  2010-03-12 14:15:29,912 SEVERE [org.hornetq.core.client.impl.ClientConsumerImpl] (Thread-47 (group:HornetQ-client-global-threads-1505282694)) Failed to call onMessage()
                                  java.lang.IllegalStateException: afterDelivery without a previous beforeDelivery for message endpoint HistoricMessageBean
                                      at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.after(MessageInflowLocalProxy.java:225)
                                      at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.invoke(MessageInflowLocalProxy.java:136)
                                      at $Proxy498.afterDelivery(Unknown Source)
                                      at org.hornetq.ra.inflow.HornetQMessageHandler.onMessage(HornetQMessageHandler.java:234)
                                      at org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:767)
                                      at org.hornetq.core.client.impl.ClientConsumerImpl.access$100(ClientConsumerImpl.java:45)
                                      at org.hornetq.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:885)
                                      at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:96)
                                      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
                                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
                                      at java.lang.Thread.run(Unknown Source)

                                   

                                   

                                  Now i can't test it again, but the next days i will try to fix the update problem and see if the problem persists! But It seems to me that the problem is the same you had..

                                  I'll tell you if it worked

                                   

                                  Thank you both guys!

                                  Cheers,

                                  Rodrigo

                                  • 14. Re: MDB endpoint in use
                                    Rodrigo Neves Newbie

                                    Hi,

                                     

                                    The problem is solved! I added some transactional protection to my code and now the update exception never occurs... and the endpoint exception too

                                     

                                    Thanks again.

                                    Best Regards,

                                    Rodrigo

                                    1 2 Previous Next