I have a web application that makes use of JTA to support transactions spanning MD POJOs and database access. This is all set up via Spring and Jencks using JCA.

The problem I am having is that it seems the connection pool is closing idle connections and still passing them on to transactions occasionally.

In the following log snippet, I have a simple Java timer (thread Timer-1) calling a facade method checkCompletedJobs() which does some basic JDBC via Hibernate. Everything will run along happily until idle connections are cleaned up by the connection pool, at which time there seems to be a chance that an already closed connection will be passed onto a new transaction.

2006-04-02 21:44:36,876 [Timer-0] DEBUG enhydra.jdbc.xapool(66) -> StandardXAConnection:close the XAConnection
2006-04-02 21:44:36,885 [Timer-0] DEBUG enhydra.jdbc.xapool(66) -> StandardXADataSource:connectionClosed
2006-04-02 21:44:39,565 [Timer-1] DEBUG transaction.interceptor.TransactionInterceptor(66) -> Getting transaction for com.nucleics.work.WorkManager.checkCompletedJobs
2006-04-02 21:44:39,566 [Timer-1] DEBUG transaction.jta.JtaTransactionManager(66) -> Using transaction object [EMAIL PROTECTED]
2006-04-02 21:44:39,566 [Timer-1] DEBUG transaction.jta.JtaTransactionManager(66) -> Creating new transaction with name [com.nucleics.work.WorkManager.checkCompletedJobs]
2006-04-02 21:44:39,566 [Timer-1] DEBUG transaction.support.TransactionSynchronizationManager(66) -> Initializing transaction synchronization
2006-04-02 21:44:39,567 [Timer-1] DEBUG nucleics.work.WorkManagerImpl(66) -> checkCompletedJobs()
2006-04-02 21:44:39,567 [Timer-1] DEBUG transaction.support.TransactionSynchronizationManager(66) -> Bound value [EMAIL PROTECTED] for key [EMAIL PROTECTED] to thread [Timer-1]
2006-04-02 21:44:39,568 [Timer-1] DEBUG transaction.support.TransactionSynchronizationManager(66) -> Retrieved value [EMAIL PROTECTED] for key [EMAIL PROTECTED] bound to thread [Timer-1]
2006-04-02 21:44:39,571 [Timer-1] DEBUG connector.outbound.SinglePoolConnectionInterceptor(54) -> Returning pooled connection [EMAIL PROTECTED]
2006-04-02 21:44:39,572 [Timer-1] DEBUG enhydra.jdbc.xapool(66) -> StandardXAConnection:start associate the current connection with a global transaction
2006-04-02 21:44:39,572 [Timer-1] DEBUG enhydra.jdbc.xapool(66) -> StandardXAConnection:doStart xid='[globalId=ffffffe820000005748415420444f2057452043414c4c2049543f0000000000000000000000000000000000000,branchId=100000005748415420444f2057452043414c4c2049543f0000000000000000000000000000000000000]' flags='0'
2006-04-02 21:44:39,573 [Timer-1] DEBUG enhydra.jdbc.xapool(66) -> StandardXADataSource:getFreeConnection
2006-04-02 21:44:39,574 [Timer-1] DEBUG enhydra.jdbc.xapool(66) -> StandardXADataSource:getFreeConnection return a connection from the free list
2006-04-02 21:44:39,574 [Timer-1] DEBUG enhydra.jdbc.xapool(66) -> StandardXADataSource:getFreeConnection setAutoCommit(true)
2006-04-02 21:44:39,575 [Timer-1] ERROR enhydra.jdbc.xapool(102) -> StandardXADataSource:getFreeConnection ERROR: Failed while autocommiting a connection: java.sql.SQLException: No operations allowed after connection closed.

Am I correct in assuming the pool passed the facade method a closed connection? I've read that StandardXADataSource can make use of setCheckLevelObjet(4) to force checking of the health of a connection prior to passing it on -- and recreate one if required -- but I do not think I have easy access to that object when using a Jencks pool, nor do I think that would be standard practice. I will include my configuration of the JCA resource in a following post, as I am using HTML formating here.


View this message in context: JDBC XA, SinglePoolFactoryBean and idle connections.
Sent from the jencks - user forum at Nabble.com.

Reply via email to