Tuesday, March 8, 2011

ConnectionPooling and Transaction

In websphere 6.1 if you see the below error messages they are logged because a commit or rollback was not performed in the transaction boundary for which we will be able to find many posts from google.

LocalTranCoor W CWWLT0033W: Resource jdbc/datasource rolled back in cleanup of LocalTransactionContainment.
LocalTranCoor W CWWLT0032W: One or more local transaction resources were rolled back during the cleanup of a LocalTransactionContainment.


Debugging gets complicated when Transaction layer is not tested thoroughly in local environments.

In My case a Method which performs the Transaction was defined with a definition "PROPAGATION_REQUIRED".One of the DAO classes did not commit or rollback(Yes ,thats a Code issue). So the Transaction manager rolled back the transaction. This situation described above starts to get worse when we use connection pooling.

Basics to recollect before we implement transaction


Transaction is always associated with a connection.

A transaction cannot span Connections.

Any number of Threads can have access to a Single Connection.


When multiple threads get access to a connection associated with an incomplete transaction fails to create new Transactions(for definition PROPAGATION_REQUIRED) which causes intermittent issues.

This below link will give more information about Transaction definitions.

http://stackoverflow.com/questions/4944349/spring-transaction-management-for-execution-service-methods-from-same-service


Thanks
Prem

1 comment:

Supaluk said...

LocalTranCoor W WLTC0033W: Resource rolled back in cleanup of LocalTransactionContainment.
LocalTranCoor W WLTC0032W: One or more local transaction resources were rolled back during the cleanup of a LocalTransactionContainment.

:: QUESTION ::
I found a lot of rollback in SystemOut.log (WebSphere application server 6.0.2.11)

I would like to know the root cause and solution to fix this error in log. Thank you very much. :)