This can be due to the way you handle the transactions. If you try to handle transactions manually with setAutoCommit() and at the same time try to use session beans which in turn do some
database operations using the datasource or entity beans or any other way this can happen.
Solution is to use JTA transactions for your manual transaction part. Following code snippet explains how.
UserTransaction ut = (UserTransaction) c.lookup("java:comp/UserTransaction");
try {
ut.begin();
//insert your database manipulation code here.
//insert your session beans access code here.
ut.commit();
} catch (Throwable ex) {
try {
ut.rollback();
} catch (SystemException syex) {
throw new Exception( "Rollback failed: " + syex.getMessage());
}
throw new Exception( "Transaction failed: " + ex.getMessage());
}
You can refer to my blog for more information.
http://kishantha.blogspot.com/2009/06/mixing-transactions-manual-and.html