If there is an active transaction when you make a call to getConnection the container will try to enlist the connection in the transaction. But I notice from the stack trace that you are trying to get the connection from an AfterCompletion synchronisation - ie the transaction has already finished (and that is why WrapperDataSource throws the exception). Is this what you are intending?