Uploaded image for project: 'Commons DBCP'
  1. Commons DBCP
  2. DBCP-356

ManagedDataSource doesn't work with an active transaction in progress on IBM JDK 6+

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Cannot Reproduce
    • 1.3, 1.4
    • 1.3.1, 1.4.1

    Description

      When using IBM JDK 6+ and trying to build commons-dbcp, these tests fail:

      org.apache.commons.dbcp.managed.TestBasicManagedDataSource
      org.apache.commons.dbcp.managed.TestManagedDataSourceInTx

      with error:

      java.sql.SQLException: Connection does not have a registered XAResource null, UserName=null, null
      at org.apache.commons.dbcp.managed.TransactionRegistry.getXAResource(TransactionRegistry.java:81)
      at org.apache.commons.dbcp.managed.TransactionContext.setSharedConnection(TransactionContext.java:88)
      at org.apache.commons.dbcp.managed.ManagedConnection.updateTransactionStatus(ManagedConnection.java:131)
      at org.apache.commons.dbcp.managed.ManagedConnection.<init>(ManagedConnection.java:55)
      at org.apache.commons.dbcp.managed.ManagedDataSource.getConnection(ManagedDataSource.java:76)
      at org.apache.commons.dbcp.managed.TestManagedDataSource.getConnection(TestManagedDataSource.java:53)
      at org.apache.commons.dbcp.TestConnectionPool.newConnection(TestConnectionPool.java:81)
      at org.apache.commons.dbcp.managed.TestManagedDataSourceInTx.testMaxActive(TestManagedDataSourceInTx.java:102)

      When used in conjunction with OpenEJB 3.1.4 examples, the error is the same.

      The problem disappears when switched to Oracle JDK 1.6.24 (so, all tests are passed and OpenEJB examples are working).

      I beleive this has something to do with differences in java.lang.ref.WeakReference implementations between IBM and Oracle JDKs, which was already discussed here:
      http://www.mail-archive.com/dev@commons.apache.org/msg13107.html

      Attachments

        1. commons-dbcp-TransactionRegistry.diff
          2 kB
          Allan Saddi
        2. TransactionRegistry.java.patch
          2 kB
          Balazs Zsoldos
        3. TransactionRegistry.java.patch
          1 kB
          Balazs Zsoldos

        Issue Links

          Activity

            People

              Unassigned Unassigned
              anenvyguest an envy guest
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: