Thread: XA capable driver

XA capable driver

From
"G.L. Grobe"
Date:
I'm not totally up to par about knowing what XA capabilities are in a driver, but as I understand it, my errors are because the postgres driver doesn't support XA datasources.
 
Problem is I'm not sure how to fix this? Is there a postgres driver somewheres that does support them or do I need to make different JBoss (application server) configurations of my datasources?
 
Any help much appreciated.
 

Re: XA capable driver

From
Aaron Mulder
Date:
On Tue, 30 Jul 2002, G.L. Grobe wrote:
> I'm not totally up to par about knowing what XA capabilities are in a
> driver, but as I understand it, my errors are because the postgres
> driver doesn't support XA datasources.
>
> Problem is I'm not sure how to fix this? Is there a postgres driver
> somewheres that does support them or do I need to make different JBoss
> (application server) configurations of my datasources?

    Which version of JBoss?  The jboss.jcml exerpt below works for
2.4.x.

Aaron


  <mbean code="org.jboss.jdbc.JdbcProvider" name="DefaultDomain:service=JdbcProvider">
     <attribute name="Drivers">org.postgresql.Driver</attribute>
  </mbean>

  <mbean code="org.jboss.jdbc.XADataSourceLoader" name="DefaultDomain:service=XADataSource,name=postgres">
    <attribute name="PoolName">postgres</attribute>
    <attribute name="DataSourceClass">org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl</attribute>
    <attribute name="Properties"></attribute>
    <attribute name="URL">jdbc:postgresql://server/database</attribute>
    <attribute name="GCMinIdleTime">1200000</attribute>
    <attribute name="JDBCUser">user</attribute>
    <attribute name="MaxSize">10</attribute>
    <attribute name="Password">password</attribute>
    <attribute name="GCEnabled">false</attribute>
    <attribute name="InvalidateOnError">false</attribute>
    <attribute name="TimestampUsed">false</attribute>
    <attribute name="Blocking">true</attribute>
    <attribute name="GCInterval">120000</attribute>
    <attribute name="IdleTimeout">1800000</attribute>
    <attribute name="IdleTimeoutEnabled">false</attribute>
    <attribute name="LoggingEnabled">false</attribute>
    <attribute name="MaxIdleTimeoutPercent">1.0</attribute>
    <attribute name="MinSize">2</attribute>
  </mbean>


Re: XA capable driver

From
"G.L. Grobe"
Date:
I'm using this very thing now. JBoss 2.4.x w/ a data source setup as you've
listed below. Even so, there are XA errors and warning I'm receiving in
places because the driver is not XA capable and I don't know how to get
around this.

----- Original Message -----
From: "Aaron Mulder" <ammulder@alumni.princeton.edu>
To: <pgsql-jdbc@postgresql.org>
Sent: Wednesday, July 31, 2002 10:31 AM
Subject: Re: [JDBC] XA capable driver


> On Tue, 30 Jul 2002, G.L. Grobe wrote:
> > I'm not totally up to par about knowing what XA capabilities are in a
> > driver, but as I understand it, my errors are because the postgres
> > driver doesn't support XA datasources.
> >
> > Problem is I'm not sure how to fix this? Is there a postgres driver
> > somewheres that does support them or do I need to make different JBoss
> > (application server) configurations of my datasources?
>
> Which version of JBoss?  The jboss.jcml exerpt below works for
> 2.4.x.
>
> Aaron
>
>
>   <mbean code="org.jboss.jdbc.JdbcProvider"
name="DefaultDomain:service=JdbcProvider">
>      <attribute name="Drivers">org.postgresql.Driver</attribute>
>   </mbean>
>
>   <mbean code="org.jboss.jdbc.XADataSourceLoader"
name="DefaultDomain:service=XADataSource,name=postgres">
>     <attribute name="PoolName">postgres</attribute>
>     <attribute
name="DataSourceClass">org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl</attr
ibute>
>     <attribute name="Properties"></attribute>
>     <attribute name="URL">jdbc:postgresql://server/database</attribute>
>     <attribute name="GCMinIdleTime">1200000</attribute>
>     <attribute name="JDBCUser">user</attribute>
>     <attribute name="MaxSize">10</attribute>
>     <attribute name="Password">password</attribute>
>     <attribute name="GCEnabled">false</attribute>
>     <attribute name="InvalidateOnError">false</attribute>
>     <attribute name="TimestampUsed">false</attribute>
>     <attribute name="Blocking">true</attribute>
>     <attribute name="GCInterval">120000</attribute>
>     <attribute name="IdleTimeout">1800000</attribute>
>     <attribute name="IdleTimeoutEnabled">false</attribute>
>     <attribute name="LoggingEnabled">false</attribute>
>     <attribute name="MaxIdleTimeoutPercent">1.0</attribute>
>     <attribute name="MinSize">2</attribute>
>   </mbean>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>


Re: XA capable driver

From
Aaron Mulder
Date:
On Wed, 31 Jul 2002, G.L. Grobe wrote:
> I'm using this very thing now. JBoss 2.4.x w/ a data source setup as you've
> listed below. Even so, there are XA errors and warning I'm receiving in
> places because the driver is not XA capable and I don't know how to get
> around this.

    If there's any "postgresql" in the error/warning/stack trace,
please post it here.  Otherwise, perhaps you could just e-mail it to me
off-list.

Aaron


Re: XA capable driver

From
"G.L. Grobe"
Date:
> If there's any "postgresql" in the error/warning/stack trace,
> please post it here.  Otherwise, perhaps you could just e-mail it to me
> off-list.

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());
         }
      }
   }




Re: XA capable driver

From
Aaron Mulder
Date:
    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".
    In any case, since there are no database errors below, please
reply off-list.

Aaron

On Thu, 1 Aug 2002, G.L. Grobe wrote:
> > If there's any "postgresql" in the error/warning/stack trace,
> > please post it here.  Otherwise, perhaps you could just e-mail it to me
> > off-list.
>
> 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());
>          }
>       }
>    }
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>