I have seen similar post's on this, but not entirely the same or with a resolution that could possibly help my problem. My parent servlet retrieves necessary connections for each request using the javax.sql.Datasource. These are local-tx-datasources. Each connection is retrieved and stored in a map which is then passed down to children servlets which then use the connections as needed. Once control is returned to the parent servlet all connections are closed(i.e., returned to the pool).
Each time the connection is returned from the map for use it is validated to confirm that it is not null or closed. If it is another connection is retrieved from the pool.
My problem is that I have been getting java.sql.SQLException: Connection handle has been closed and is unusable errors quite a bit lately. We are using 3.2.3 and the DB's are Oracle and DB2. It happens on both. From the stack traces it seems that the connection is being closed/invalidated while inside a series of method calls. It generally happens during some of the more intense portion of the logic where the connection is being hung onto for a bit(10-15 seconds). For example, the logic will call a series of methods (A,B,C,D) and it will fail in C. It is never in the same place either, so I know it is not a code issue. Also, we have ran STA load test's and have been unable to replicate in a development environement.
I have read where people have proposed a threading issue. Other's have mentioed setting SpecCompliant to true as a solution. Any advise would be appreciated.