It looks as if quite a few people are having similar problems with the JBoss JCA implementation.
Reading the JCA 1.0 specification and looking at the source (InternalManagedConnectionPool) for JBoss 3.0.6 and JBoss 4 it looks as if the implementation within JBoss does not meet the requirements of the specification.
The area that is causing the problems is how the matchManagedConnections method is handled, the purpose of this method is described in the JCA specification as: -
The method matchManagedConnections enables application server to use a resource adapter specific criteria for matching a ManagedConnection instance to service a connection request. Application server finds a candidate set of ManagedConnection instances from its connection pool based on application server-specific criteria and passes this candidate set to the matchManagedConnections method.
The method matchManagedConnections matches a candidate set of connections using criteria known internally to the resource adapter. The criteria used for matching is specific to a resource adapter and is not specified by the connector architecture.
According to the specification if a suitable connection can not be found in the candidate set of ManagedConnections the method matchManagedConnections should return null to so that the application server can request that a new connection is created.
Within JBoss 3.0.6, if null is returned an error "Error in use of ManagedConnectionPool:" is raised and no new connection is created.
Looking at the code for JBoss 4 this specific problem looks as if has been solved.
The second problem with the current JCA implementation is that only one connection will be passed into the matchManagedConnections method as a candidate connection. If this connection is not suitable, any other connections in the pool that may be suitable will be overlooked.
As I already said it does look as if the first problem has been resolved within JBoss 4, however it looks as if a new problem has been added. If the matchManagedConnections method returns null the ManagedConnection that was passed in is destroyed, this is not appropriate, as the ManagedConnection may be suitable for another request.
According to the JBoss FAQ at http://www.jboss.org/faq.pdf, JBoss includes full support for J2EE -based APIs, these limitations suggest otherwise.
Is there any indication as to when these faults are going to be fixed within JBoss?