cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Transaction System Failure when using XA DataSource

Former Member
0 Likes
1,439

Hi,

I get "Transaction system failure" exception when I attempt to call for example an ejb method with SUPPORTS attribute set and right after calling an ejb method with transaction REQUIRED. This is happening XA Driver (on oracle). It does not seem to be working as designed :). I think the problem occurs in transactions after each time Datasource was used in a non-transactional context.

EnableLocalResourceInOTS is true.

To illustrate the problem please the test snippet below that is failing:

 public void testSupportsAndRequired() throws Exception {
        // calls an ejb method with SUPPORTS attr
        callEJBMethod1();
        // calls an ejb method with REQUIRED attr
        callEJBMethod2();
    }

Below is jdbc 2.0 section from data_sources.xml.

<jdbc-2.0>
        <xads-class-name>
          oracle.jdbc.xa.client.OracleXADataSource
        </xads-class-name>
        <properties>
          <property>
            <property-name>
              URL
            </property-name>
            <property-value>
              jdbc:oracle:thin:@app02:1521:VP40
            </property-value>
          </property>
          <property>
            <property-name>
              Password
            </property-name>
            <property-value encrypted="true">
              5e695d694c5c695d4b
            </property-value>
          </property>
          <property>
            <property-name>
              User
            </property-name>
            <property-value>
              vm32wip
            </property-value>
          </property>
        </properties>
      </jdbc-2.0>

View Entire Topic
Former Member
0 Likes

Hi Mikhail,

Could you please send me the beans that are performing the database operations?

Kind regards,

Andrei

Former Member
0 Likes

Hi Andrey,

We use a quite nested hierarchy for our beans so it just does not make sense to send you the sources as it contains a lot of redundant stuff and might take a lot of your time.

However let me guess and assume that what you are trying to see is how we actually access the database.

I extracted and modified some code to illustrate this. I hope this will help, otherwise please let me know.

Regards,

Mikhail

  DataSource _dataSource = (DataSource)   _initialContext.lookup( "jdbc/wipPool" ); 

  public java.sql.Connection getDBConnection()
    {
        java.sql.Connection con = null;
        try
        {
            con = _dataSource.getConnection();
            return con;
        }
        catch ( SQLException se )
        {
            traceSQLException( se, (String)null );
            throw new EJBException( se );
        }
    }


    final public Data executeQuery(String sql) {
        Data res = null;
        java.sql.Connection con=null;

        try {
             con = getDBConnection();
             res = _sqlInterface.executeQuery(con,sql,convertDates);
            return res;
        } catch ( SQLException se ) {
            traceSQLException( se, sql );
            throw new EJBException( se );
        }
    }

nikolai_tankov
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi Mikhail,

Do you close the connection after first non-transacted method call? Could you try to close the connection after each connection usage.

You said that there are 2 methods. First with tx-supports and second with tx-required. Do you have transaction from outside? Do you have transaction in supports method?

When you receive the exception? probably after required method.

Which version of the engine you use ?

Could you send me the exact version of the DB driver or just send me the driver. I want to reproduce the problem with same driver.

Excuse me for these questions but this information will help me.

Best regards,

Nikolai.

Former Member
0 Likes

Hi Nikolai,

No problem with questions, I totally understand. So I listed your questions with my answers below:

<i>1. Do you close the connection after first non-transacted method call? Could you try to close the connection after each connection usage.

</i>

Yes, connections are always closed after each db call.

Good question though, as I saw a similar exception (stacktrace attached) in case of connection leaks.

<i>You said that there are 2 methods. First with tx-supports and second with tx-required. Do you have transaction from outside? Do you have transaction in supports method?

</i>

There is no transaction from outside. There is no transaction in the "supports" method.

<i>When you receive the exception? probably after required method.

</i>

You are exactly right.

<i>Which version of the engine you use ?</i>

6.40SP9

However the original postings were done basing on 6.40 (for windows 2000 / XP). After migrating to 6.40SP9 the exception has changed. I attached the trace below.

<i>Could you send me the exact version of the DB driver or just send me the driver. I want to reproduce the problem with same driver.</i>

Sure, Oracle JDBC Driver version - 9.0.2.0.0. If you need the driver, just let me know where to send it.

Please let me know if you have any questions.

Thanks,

Mikhail

Here is the latest trace (I extracted a part of it as this thread is probably already the longest one in terms of lines )


Caused by: com.sap.engine.services.connector.exceptions.BaseResourceException: Error in ResourceSet.addAndEnlist("com.sap.engine.services.connector.resource.impl.HandleWrapper@79717e[com.sap.engine.services.dbpool.cci.ConnectionHandle@244a0c](delisted:false) -> com.sap.engine.services.connector.resource.impl.MCEventHandler@412213 --> 3(locTrSupp:false)").
	at com.sap.engine.services.connector.jca.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:241)
	at com.sap.engine.services.dbpool.cci.ConnectionFactoryImpl.getConnection(ConnectionFactoryImpl.java:51)
	... 18 more
Caused by: com.sap.engine.services.ts.exceptions.BaseSystemException: Cannot enlist resource:oracle.jdbc.xa.client.OracleXAResource@10a3078 into jta transaction because of XAException from xaResource.start(xid, XAResource.TMNOFLAGS) 
	at com.sap.engine.services.ts.jta.impl.TransactionImpl.enlistResource(TransactionImpl.java:566)
	at com.sap.engine.services.connector.resource.impl.ResourceSetImpl.addAndEnlist(ResourceSetImpl.java:264)
	at com.sap.engine.services.connector.jca.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:238)
	... 19 more
Caused by: javax.transaction.xa.XAException
	at oracle.jdbc.xa.OracleXAResource.disallowLocalTxnMode(OracleXAResource.java:1045)
	at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:153)
	at com.sap.engine.services.ts.jta.impl.TransactionImpl.enlistResource(TransactionImpl.java:556)
	... 21 more

nikolai_tankov
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi Mikhail,

I think that the problem is into Oracle Driver. With 9.2.0.3 this problem is reproduceable but with 9.2.0.6 this scenario is working.

Please try to change the driver and rerun your scenario.

Best regards,

Nikolai.

Former Member
0 Likes

Hi Nikolai,

Thanks for your answer, the problem indeed was in the driver.

I could not find 9.2.0.6 readily available for download, and downloaded 9.2.0.5. It did not fix the problem though. Then I switched from thin to OCI and it solved it.

BTW, it failed on netweaver only as the same (thin) configuration was tested weblogic, jboss and websphere.

Regards,

Mikhail

nikolai_tankov
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi Mikhail,

This problem was reported in bea and JBoss forums so I think that the this scenario is not supported from the driver.

The behavior of the driver is: when one connection is used without transaction that this connection cannot be used inside a transaction.

Probably your tests are slightly different on different servers .

Best regards,

Nikolai.