You need to add two things:
- the datasource need to have the setting use-ccm=true
- the jca subsystem cache-connection-manager need to have the debug setting, you can active in standalone mode via CLI with
If you have this enabled you will see a stacktrace and a message that the connection is closed for you.
But it's recommended to fix the code!
I had seen this solution and I'm even using it, however, do not think that is the ideal. Both Tomcat and Glassfish you can specify a timeout for the server to close the connection.
In the case of CCM the connection is closed so my business method is finished and this behavior may not be the desired in some situation.