Matt,

There seem to be few problems here.

First, what is full version of your oracle server? I remember we had occasional XAER_RMERR with 8.1.7.0 but everything works fine with 8.1.7.3 and 9.2.0.1. I've attached a simple standalone application that approximates JBoss behavoir. Check if it fails with your database.

Second, there was a concurrency problem in JBoss XA datasource wrapper. This problem accounts for "java.sql.SQLException: Invalid Oracle URL specified: OracleDataSource.makeURL" and it is fixed in cvs now.

And last. XAException during transaction commit should be propagated back to the client unless the transaction was successfully retried by HA configuration. I am not too familiar with JBoss HA, but after quick look into the code I believe that HA invoker does retry failed transaction.

Matt Cleveland wrote:
Perhaps I've missed something here.  I've been so busy watching my log files
that I did not recognize that the client is not receiving this error.  In
fact it is only reported as a warning.  Still it's pretty scary to see these
flying by in the log file.  It leaves you wondering if the transaction
committed or rolled back.  From the stack trace I believe that the
transaction rolled back and this is still an Oracle concurrency bug, but if
that's not the case I wish the log message told me that.

Thanks,
Matt Cleveland


2003-01-21 21:42:09,141 WARN  [org.jboss.tm.TransactionImpl]
XAException: tx=Tra
nsactionImpl:XidImpl [FormatId=257, GlobalId=malt//1809, BranchQual=]
errorCode=
XAER_RMERR
oracle.jdbc.xa.OracleXAException
       at
oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:1157
)
       at
oracle.jdbc.xa.client.OracleXAResource.commit(OracleXAResource.java:5
90)
       at
org.jboss.resource.adapter.jdbc.xa.XAManagedConnection.commit(XAManag
edConnection.java:140)
       at
org.jboss.tm.TransactionImpl.commitResources(TransactionImpl.java:142
0)
       at
org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:349)

       at
org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCM
T.java:361)
       at
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxIntercep
torCMT.java:247)
       at
org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:1
01)
       at
org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.
java:130)
       at
org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:204)
       at
org.jboss.ejb.plugins.CleanShutdownInterceptor.invoke(CleanShutdownIn
terceptor.java:265)
       at
org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFacto
ryFinderInterceptor.java:154)
       at
org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContai
ner.java:303)
       at org.jboss.ejb.Container.invoke(Container.java:680)
       at
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
       at
org.jboss.invocation.jrmp.server.JRMPInvokerHA.invoke(JRMPInvokerHA.j
ava:163)
       at java.lang.reflect.Method.invoke(Native Method)
       at
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:236)
       at sun.rmi.transport.Transport$1.run(Transport.java:147)
       at java.security.AccessController.doPrivileged(Native Method)
       at sun.rmi.transport.Transport.serviceCall(Transport.java:143)
       at
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:4
60)
       at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
.java:701)
       at java.lang.Thread.run(Thread.java:479)

oracle-xa-ds
------------------
<?xml version="1.0" encoding="UTF-8"?>

<datasources>
 <xa-datasource>
   <jndi-name>XaOracleDS</jndi-name>
   <track-connection-by-tx>true</track-connection-by-tx>


<managedconnectionfactory-class>org.jboss.resource.adapter.jdbc.xa.oracle.XA

OracleManagedConnectionFactory</managedconnectionfactory-class>


<!--xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasou

rce-class-->

   <xa-datasource-property
name="URL">jdbc:oracle:thin@server:port:sid</xa-datasource-property>
   <xa-datasource-property name="User">scott</xa-datasource-property>
   <xa-datasource-property
name="Password">tiger</xa-datasource-property>

   <min-pool-size>0</min-pool-size>
   <max-pool-size>50</max-pool-size>
   <blocking-timeout-millis>20000</blocking-timeout-millis>
   <idle-timeout-minutes>15</idle-timeout-minutes>
 </xa-datasource>
</datasources>

Thanks,
Matt Cleveland
--
Igor Fedorenko
Think smart. Think automated. Think Dynamics.
www.thinkdynamics.com



-------------------------------------------------------
This SF.net email is sponsored by: Scholarships for Techies!
Can't afford IT training? All 2003 ictp students receive scholarships.
Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more.
www.ictp.com/training/sourceforge.asp
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development



-------------------------------------------------------
This SF.net email is sponsored by: Scholarships for Techies!
Can't afford IT training? All 2003 ictp students receive scholarships.
Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more.
www.ictp.com/training/sourceforge.asp
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development





-------------------------------------------------------
This SF.net email is sponsored by: Scholarships for Techies!
Can't afford IT training? All 2003 ictp students receive scholarships.
Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more.
www.ictp.com/training/sourceforge.asp
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development
--
Igor Fedorenko
Think smart. Think automated. Think Dynamics.
www.thinkdynamics.com
package test;

import java.sql.Connection;
import java.sql.Statement;

import javax.sql.XAConnection;
import javax.sql.XADataSource;
import javax.transaction.xa.XAException;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;

import oracle.jdbc.xa.OracleXAException;
import oracle.jdbc.xa.OracleXid;
import oracle.jdbc.xa.client.OracleXADataSource;

/**
 * Stress test. Works fine with both Oracle 8.1.7.3 and 9.2.0.1
 * 
 * @author ifedorenko
 */
public class StressTestXADatasource implements Runnable {

    static int gd = 1000;
    static XADataSource ds = null;
    static Object mutex = new Object();
    static volatile boolean run = true;

    public void run() {
        try {
            XAConnection xaconn;
            synchronized (mutex) {
                xaconn = ds.getXAConnection();
            }
            Connection conn;
            conn = xaconn.getConnection();
            XAResource xares = xaconn.getXAResource();
            for (int i = 0; ; i++) {
                if ((i % 10) == 0) {
                    System.out.println(Thread.currentThread().getName() + ": " + i);
                }
                Xid xid = createXid();
                xares.start(xid, XAResource.TMNOFLAGS);
                Statement stmt = conn.createStatement();
                try {
                    stmt.executeUpdate("insert into test(f1) values (to_char(sysdate, 
'dd:mm:yyyy'))");
                } finally {
                    stmt.close();
                }
                xares.end(xid, XAResource.TMSUCCESS);
                xares.prepare(xid);
                xares.commit(xid, false); // two-phase commit
            }
        } catch (Exception e) {
            dump(e);
        }
    }

    public static void main(String[] args) throws Exception {
        OracleXADataSource _ds = new OracleXADataSource();
//        _ds.setURL("jdbc:oracle:oci8:@tc");
        _ds.setURL("jdbc:oracle:thin:@oahu:1521:tc");
//        _ds.setURL("jdbc:oracle:thin:@10.1.1.13:1521:tc9i");
        _ds.setUser("scott");
        _ds.setPassword("tiger");
        ds = _ds;

        int max = 50;
        for (int i = 0; i < max; i++) {
            new Thread(new StressTestXADatasource()).start();
        }
    }


    static synchronized Xid createXid() throws XAException {
        byte[] _gtrid = Integer.toString(gd++).getBytes();
        byte[] _bqual = Integer.toString(1).getBytes();
        byte[] gtrid = new byte[64];
        byte[] bqual = new byte[64];
        System.arraycopy(_gtrid, 0, gtrid, 0, _gtrid.length);
        System.arraycopy(_bqual, 0, bqual, 0, _bqual.length);
        Xid xid = new OracleXid(0x1234, gtrid, bqual);
        return xid;
    }
    static void dump(Throwable e) {
        e.printStackTrace();
        if (e instanceof OracleXAException) {
            OracleXAException oe = (OracleXAException) e;
            System.err.println(
                "xa error: "
                    + oe.getXAError()
                    + " ("
                    + oe.getXAErrorMessage(oe.getXAError())
                    + ")");
            System.err.println("oracle error: " + oe.getOracleError());
            System.err.println("oracle sql error: " + oe.getOracleSQLError());
        } else if (e instanceof XAException) {
            XAException xe = (XAException) e;
            System.err.println("xa error: " + xe.errorCode);
        }
    }
}

Reply via email to