4 Replies Latest reply on Dec 6, 2006 12:16 PM by weston.price

    Help on MessagingXAException

    busawreck

      I'm using Jboss Messaging 1.0.1.GA, and I'm running a test-setup where I send 3 concurrant messages every 10 seconds over a XAConnection. I'm using persistent messages and ms sql 2005 as a persistent store. After about 12 hours i get the following error once, and I don't have a clue how to investigate it, any help appreciated. The message causing the exception is lost.

      Stacktrace:
      04:15:05,968 ERROR [org.jboss.jms.server.endpoint.ServerConnectionEndpoint] Exception occured
      com.microsoft.sqlserver.jdbc.SQLServerException: Transaction (Process ID 58) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
      at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
      at com.microsoft.sqlserver.jdbc.IOBuffer.processPackets(Unknown Source)
      at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.getPrepExecResponse(Unknown Source)
      at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown Source)
      at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PreparedStatementExecutionRequest.executeStatement(Unknown Source)
      at com.microsoft.sqlserver.jdbc.CancelableRequest.execute(Unknown Source)
      at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeRequest(Unknown Source)
      at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(Unknown Source)
      at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:251)
      at org.jboss.messaging.core.plugin.JDBCPersistenceManager.commitPreparedTransaction(JDBCPersistenceManager.java:3895)
      ...
      04:15:06,031 ERROR [org.jboss.jms.util.ExceptionUtil] ConnectionEndpoint[-2147483549] sendTransaction [5c4o05-vxggw-euvg861g-1-euw0ugfj-7b]
      org.jboss.jms.util.MessagingJMSException: Failed to commit transaction
      at org.jboss.jms.server.endpoint.ServerConnectionEndpoint.sendTransaction(ServerConnectionEndpoint.java:422)
      at org.jboss.jms.server.endpoint.advised.ConnectionAdvised.org$jboss$jms$server$endpoint$advised$ConnectionAdvised$sendTransaction$aop(ConnectionAdvised.java:104)
      at sun.reflect.GeneratedMethodAccessor84.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
      ...
      04:15:06,046 ERROR [org.jboss.jms.client.container.ExceptionInterceptor] Linked exception is:
      com.microsoft.sqlserver.jdbc.SQLServerException: Transaction (Process ID 58) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
      at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
      at com.microsoft.sqlserver.jdbc.IOBuffer.processPackets(Unknown Source)
      at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.getPrepExecResponse(Unknown Source)
      at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown Source)
      at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PreparedStatementExecutionRequest.executeStatement(Unknown Source)
      at com.microsoft.sqlserver.jdbc.CancelableRequest.execute(Unknown Source)
      at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeRequest(Unknown Source)
      at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(Unknown Source)
      at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:251)
      ...
      04:15:06,062 WARN [org.jboss.tm.TransactionImpl] XAException: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=Manga-L/253607, BranchQual=, localId=253607] errorCode=XAER_RMERR
      org.jboss.jms.util.MessagingXAException: A Throwable was caught in sending the transaction
      at org.jboss.jms.tx.ResourceManager.sendTransactionXA(ResourceManager.java:486)
      at org.jboss.jms.tx.ResourceManager.commit(ResourceManager.java:226)
      at org.jboss.jms.tx.MessagingXAResource.commit(MessagingXAResource.java:116)
      at org.jboss.tm.TransactionImpl$Resource.commit(TransactionImpl.java:2253)
      at org.jboss.tm.TransactionImpl.commitResources(TransactionImpl.java:1784)
      at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:358)
      at org.jboss.tm.TxManager.commit(TxManager.java:240)
      at org.jboss.aspects.tx.TxPolicy.endTransaction(TxPolicy.java:175)
      ...
      Caused by: org.jboss.jms.util.MessagingJMSException: Failed to commit transaction
      at org.jboss.jms.server.endpoint.ServerConnectionEndpoint.sendTransaction(ServerConnectionEndpoint.java:422)
      at org.jboss.jms.server.endpoint.advised.ConnectionAdvised.org$jboss$jms$server$endpoint$advised$ConnectionAdvised$sendTransaction$aop(ConnectionAdvised.java:104)
      at sun.reflect.GeneratedMethodAccessor84.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)



        • 1. Re: Help on MessagingXAException
          timfox

          Please post your code example. Thanks.

          • 2. Re: Help on MessagingXAException
            busawreck

            Here comes what my code looks like, kind of anyway, exception handling omitted. I've run the same test setup 4 more times, but I only got the error once more.

            @Stateless
            public SenderBean implements Sender {

            Connection con = null;


            public void send(Serializable obj, String destination) {
            Session session = con.createSession(false, Session.AUTO_ACKNOWLEDGE);
            InitialContext ctx = new InitialContext();
            Destination destination = (Destination) ctx.lookup(destination);
            MessageProducer producer = session.createProducer(destination);
            ObjectMessage objMsg = session.createObjectMessage(obj);
            producer.send(objMsg);
            session.close();
            }

            @Postconstruct
            public void init() {
            InitialContext ctx = new InitialContext();
            ConnectionFactory tcf = (ConnectionFactory) ctx.lookup("java:/JmsXA");
            con = tcf.createConnection();
            }

            @PreDestroy
            public void destroy() {
            con.close();
            }
            }

            • 3. Re: Help on MessagingXAException
              timfox

              I am not an expert in MSSQL but I know that some databases (e.g. MySQL) can deadlock even when only a single row is being updated.

              To cope with this we detect and retry in deadlock situations for some updates. The next maintenance release in the 1.0 series (out soon) will have improved deadlock detection so may help you out.

              • 4. Re: Help on MessagingXAException
                weston.price

                Also, MSSQL has some pretty strict requirements regarging configuration, installation etc when it comes to XA. Also, what version of the MSSQL driver are you using. Have you tried the JTDS driver as well?