'Random Hibernate Session is closed! errors

After migrating from Java 7, Spring 3 and Hibernate 3 to java 8, Spring 4.3.28 and Hibernate 4.3.11.

We are experimenting the following errors:

org.springframework.orm.hibernate4.HibernateSystemException: Session is closed!; nested exception is org.hibernate.SessionException: Session is closed!
…e4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:218)
…m.hibernate4.SpringSessionSynchronization.beforeCommit(SpringSessionSynchronization.java:107)
…rt.TransactionSynchronizationUtils.triggerBeforeCommit(TransactionSynchronizationUtils.java:95)
… org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerBeforeCommit(AbstractPlatformTransactionManager.java:936)
…pport.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:748)
…tion.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:734)
…ansactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:522)
…eptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:293)
….transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
…ework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
…pringframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
                         com.sun.proxy.$Proxy299.remove(Unknown Source)

More info about our configuration is:

  • We are using C3P0 as connection pool: com.mchange.v2.c3p0.ComboPooledDataSource with the cofiguration testConnectionOnCheckin = true, testConnectionOnCheckout=false, unreturnedConnectionTimeout=60
  • We are using de OpenSessionInViewFilter

After lauch the application, no errors are thrown and the funcionalities are working, when the load starts the error starts appearing.

How can I debug and understand the problem that it´s hard to reproduce on my local?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source