Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-2497

Transaction suspend returns connection to pool for closure causing resume to throw exception

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.8, 2.0 RC2, 2.0 RC3
    • Fix Version/s: 2.0 RC4, 1.2.9
    • Component/s: Transaction
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      Please refer to posting http://forum.springframework.org/showpost.php?p=74520&postcount=13

      I'm utilizing Spring's transaction interceptor to manage my transactions and JtaTransactionManager as I have distributed transactions that need to occur. But the real problem is with suspend/resume and the DataSourceUtils class. It appears that there is some recursion happening.

      My data source is getting wrapped in a TransactionAwareDataSourceProxy in the iBatis SqlClientMapFactoryBean.

      When a request is made in the SqlMapClientTemplate execute method, a request is made for a connection. This is accomplished with a call to DataSourceUtils.getConnection(getDataSource()). The call to getDataSource() returns the TransactionAwareDataSourceProxy and passes it into the getConnection method. A call is then made to doGetConnection(dataSource). The line of code is as follows:

      ConnectionHolder conHolder = (ConnectionHolder) TransactionSynchronizationManager.getResource(dataSource);

      This call returns null as it is the first request. The line of code executed is a logging statement:

        Attachments

          Activity

            People

            Assignee:
            juergen.hoeller Juergen Hoeller
            Reporter:
            cmathrusse Chris Mathrusse
            Last updater:
            Spring Issuemaster
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              1 year, 35 weeks, 5 days ago