Our team has run into problems with the usage of EJB container-managed transactions. The specific exception I am encountering is : (java.sql.SQLException: DSRA9002E: ResourceException with error code null: javax.resource.ResourceException: enlist: caught Exception
The platform I am running on is IBM Websphere Application Server 5.1 with DB2. The JDBC driver for data access is the Type 2 DB2 Universal JDBC Driver - XA.
All data access within the application is routed though a single / central stateless session fa�ade. The fa�ade delegates the call to a set of "manager classes", which then invoke different DAO classes to perform the required data access operations. Some of these data access operations require transactional support, which I am accomplishing using container-managed transactions. The transaction attribute is set to "Required" for the methods that need this level of transactional support. This framework has actually been working fine for the last several weeks.
Very recently, this error has been induced by some "faulty" code or configuration. Bypassing the WEB/EJB layer and hitting the DAO layer directly (fired through a test JSP/JUnit) works perfectly fine. I tested this against the latest code multiple times and all is well on that front. What that essentially means is that the problem is being triggered somewhere in the Struts/WEB or EJB layer.
From the details of the exception, it's pretty clear that the container was unable to enlist the connection within the scope of the transaction. As a workaround, I set the transaction attribute to "Supports" for all the methods, and that caused things to start working. Clearly though, that is not the long-term solution since we do need container-managed transactions to work for us.