0 Replies Latest reply on Aug 1, 2002 3:52 PM by garyg

    datasource problems

    garyg

      Below is a conversation I had w/ someone on the pgsql-jdbc mailing list after hearing on this forum that my problem was that the postgres driver was not XA capaable.

      Can anyone shine some light on what I need to do to figure this out?

      Any help much appreciated.

      --- pgsql-jdbc mailing list response ---
      If it was a DB problem, why would JBossMQ (the JBoss JMS
      implementation) be the one throwing an exception? In a 2-phase commit session, you first prepare all the resources (DB & MQ), then if that all works, you commit. Here the prepare on the MQ fails -- there's no error from the DB. You need to find out why the SpyMQResource is failing to
      prepare on line 169. I think XAER_RMERR is a generic "Resource Manager Error" message, so it's not obvious what is causing it. Also it happens at the end of the TX, which is why it manifests "after the method has fully completed".

      > Ok, I've included the output below as well as the code that's exec'ing below that. Note that no exceptions are thrown while exec'ing the code as shown. I didn't see anything that actually came from postgres itself. This output came from JBoss 2.4.4 and it's been unanimous from the JBoss forums that this is a problem of the driver not being XA capable. This all seems to happen after the method has fully completed and is called from within a MDB.
      >
      > [WARN,TxCapsule] XAException: tx=XidImpl [FormatId=257,
      > GlobalId=cassia//182, BranchQual=] errorCode=XAER_RMERR
      > javax.transaction.xa.XAException
      > at org.jboss.mq.SpyXAResource.prepare(SpyXAResource.java:169)
      > at org.jboss.tm.TxCapsule.prepareResources(TxCapsule.java:1411)
      > at org.jboss.tm.TxCapsule.commit(TxCapsule.java:330)
      > at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:76)
      > at
      > org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:314)
      > at
      > org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageCons
      > umer.java:565)
      > at
      > org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:376)
      > at org.jboss.mq.SpySession.run(SpySession.java:248)
      > at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:172)
      > at
      > EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.ja
      > va:728)
      > at java.lang.Thread.run(Thread.java:484)
      > [WARN,TxCapsule] XAException: tx=XidImpl [FormatId=257,
      > GlobalId=cassia//182, BranchQual=] errorCode=XAER_RMERR
      > javax.transaction.xa.XAException
      > at org.jboss.mq.SpyXAResource.rollback(SpyXAResource.java:201)
      > at org.jboss.tm.TxCapsule.rollbackResources(TxCapsule.java:1540)
      > at org.jboss.tm.TxCapsule.commit(TxCapsule.java:347)
      > at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:76)
      > at
      > org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:314)
      > at
      > org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageCons
      > umer.java:565)
      > at
      > org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:376)
      > at org.jboss.mq.SpySession.run(SpySession.java:248)
      > at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:172)
      > at
      > EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.ja
      > va:728)
      > at java.lang.Thread.run(Thread.java:484)
      > [ERROR,StdServerSession] failed to commit/rollback
      > javax.transaction.RollbackException: Unable to commit, tx=XidImpl
      > [FormatId=257, GlobalId=cassia//182, BranchQual=] status=STATUS_ROLLEDBACK
      > at org.jboss.tm.TxCapsule.commit(TxCapsule.java:351)
      > at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:76)
      > at
      > org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:314)
      > at
      > org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageCons
      > umer.java:565)
      > at
      > org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:376)
      > at org.jboss.mq.SpySession.run(SpySession.java:248)
      > at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:172)
      > at
      > EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.ja
      > va:728)
      > at java.lang.Thread.run(Thread.java:484)
      >
      > --------------
      > try {
      > dbConn = getConnection();
      >
      > update = "UPDATE Tasks SET state = ?, end_time = "
      > + "(SELECT CURRENT_TIMESTAMP), errors = ?, warnings = ? "
      > + "WHERE build_id = ?";
      >
      > pstmt = dbConn.prepareStatement(update);
      >
      > pstmt.setInt(1, (int) bInfo.getStatus());
      > pstmt.setInt(2, (int) bInfo.getErrors());
      > pstmt.setInt(3, (int) bInfo.getWarnings());
      > pstmt.setInt(4, (int) bInfo.getBuildId());
      >
      > log.debug(Manager.class, update);
      >
      > int rcnt = pstmt.executeUpdate();
      > }
      > catch (SQLException sqle) {
      > log.error(Manager.class, sqle.getMessage());
      > sqle.printStackTrace();
      > }
      > catch (Exception e) {
      > log.error(Manager.class, e.getMessage());
      > e.printStackTrace();
      > }
      > finally {
      > try {
      > if (pstmt != null)
      > pstmt.close();
      > }
      > catch (Exception e) {
      > log.error(Manager.class, e.getMessage());
      > }
      >
      > try {
      > if (dbConn != null)
      > dbConn.close();
      > }
      > catch (Exception e) {
      > log.error(Manager.class, e.getMessage());
      > }
      > }
      > }
      >