javawebspherewebsphere-6.1ojdbc

J2CA0081E Websphere 6 Exception


Occasionally I see this exception. It affects some of the crucial business processes in the application. What could it be? Did anyone have similar error?

I use WebSphere 6 with OJDBC14 & Hibernate 3.

[21.02.14 06:46:03:209 PST] 00000031 MCWrapper     E   J2CA0081E: Method cleanup failed while trying to execute method cleanup on ManagedConnection WSRdbManagedConnectionImpl@4d34b403 from ressource jdbc/MYDS. Caught exception: com.ibm.ws.exception.WsException: DSRA0080E: An exception was received by the Data Store Adapter. See original exception message: Cannot call 'cleanup' on a ManagedConnection while it is still in a transaction..
    at com.ibm.ws.rsadapter.exceptions.DataStoreAdapterException.<init>(DataStoreAdapterException.java:226)
    at com.ibm.ws.rsadapter.exceptions.DataStoreAdapterException.<init>(DataStoreAdapterException.java:177)
    at com.ibm.ws.rsadapter.AdapterUtil.createDataStoreAdapterException(AdapterUtil.java:232)
    at com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.cleanupTransactions(WSRdbManagedConnectionImpl.java:3392)
    at com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.cleanup(WSRdbManagedConnectionImpl.java:3025)
    at com.ibm.ejs.j2c.MCWrapper.cleanup(MCWrapper.java:1353)
    at com.ibm.ejs.j2c.poolmanager.FreePool.returnToFreePool(FreePool.java:462)
    at com.ibm.ejs.j2c.poolmanager.PoolManager.release(PoolManager.java:1543)
    at com.ibm.ejs.j2c.MCWrapper.releaseToPoolManager(MCWrapper.java:2031)
    at com.ibm.ejs.j2c.ConnectionEventListener.connectionClosed(ConnectionEventListener.java:263)
    at com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.processConnectionClosedEvent(WSRdbManagedConnectionImpl.java:1477)
    at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.closeWrapper(WSJdbcConnection.java:724)
    at com.ibm.ws.rsadapter.jdbc.WSJdbcObject.close(WSJdbcObject.java(Compiled Code))
    at com.ibm.ws.rsadapter.jdbc.WSJdbcObject.close(WSJdbcObject.java(Compiled Code))
    at org.hibernate.connection.DatasourceConnectionProvider.closeConnection(DatasourceConnectionProvider.java:74)
    at org.hibernate.jdbc.ConnectionManager.closeConnection(ConnectionManager.java:445)
    at org.hibernate.jdbc.ConnectionManager.cleanup(ConnectionManager.java:379)
    at org.hibernate.jdbc.ConnectionManager.close(ConnectionManager.java:318)
    at org.hibernate.impl.SessionImpl.close(SessionImpl.java:293)

Update: This happens when I do session.close() in finally block. Something like this:

try {
    tx = session.beginTransaction();

    // some code

    if (!tx.wasRolledBack() && !tx.wasCommitted()) {
        tx.commit();
    }
} catch (Exception ex) {
    // rollback transaction in case of errors
}
finally {
    session.close(); // Exception happens here!
}

Solution

  • I'm having some error, I found this explain https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014153732 . He said: "I finally answered my own question. The problem was that my code was setting auto commit to false at the beginning of a transaction and did not set it back to true when the transaction was over. So when the code tried to execute single statements on the same connection object, they were not getting committed.". I hope you help.