Stuck Connections in Pool


I’ve got a Java Application using Hibernate with the following details:

Java Web Application using Apache Tobago JSF Facelets
WebSphere Application Server v9.0.0.10
Informix Dynamic Server v12.1 Database using JDBC Driver v4.10.JC13
WebSphere JDBC Connection Pool
Hibernate v5.2.17
Operating System AIX v7.2

For the most part all is working well, but there is an intermittent problem where connections are not getting released back to the connection pool and therefore WebSphere is not able to reuse or close them, resulting in new connections having to be allocated. This also results in a memory leak on the JVM and over time it eventually runs out of resource and must be restarted.

The hibernate config file settings are as follows:


I appreciate that the problem is more than likely a coding error and when a certain exception is hit it is not handling it correctly and closing off the hibernate session correctly, but I was wondering if there is a way to setup a Max Age on the Hibernate Connections so that if they get stuck like this they will eventually time out and die.

There is a Maximum Age setting in WebSphere for the Connection Pool, but as it thinks that these connections are still doing something it won’t kills them off.

Is there a way to periodically loop through the active Hibernate Sessions and ask it to close them?

If further information is required in order to understand my requirements please let me know.

Any assistance would be appreciated



Just seen that the hibernate properties have not displayed correctly and it has removed the tags, here goes again:

hibernate.connection.datasource = java:comp/env/jdbc/informix
hibernate.connection.release_mode = after_statement
hibernate.transaction.manager_lookup_class = org.hibernate.transaction.WebSphereTransactionManagerLookup
javax.transaction.UserTransaction = java:comp/UserTransaction
hibernate.dialect = org.hibernate.dialect.InformixDialect
hibernate.current_session_context_class = jta
hibernate.transaction.coordinator_class = jta
hibernate.transaction.jta.platform = WebSphere
hibernate.jta.prefer_user_transaction = false
cache.provider_class = org.hibernate.cache.NoCacheProvider
show_sql = false
hibernate.enable_lazy_load_no_trans = true