org.hibernate.SessionException: Session is closed!

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • I got an exception as the summary. I add some related debug information and stack trace at the end. I am using a JTA EntityManager associated with current container managed transaction in a J2EE server. This happends when the stateless session bean finishs its excution. When current transaction commits, the current Session is closed by CacheSynchronization class. Then AbstractEntityManagerImpl$1.afterCompletion() method is called. this method trys to get transaction in the closed session object and causes the exception. 14:09:48 DEBUG AbstractFlushingEventListener - executing flush 14:09:48 DEBUG AbstractFlushingEventListener - post flush 14:09:48 DEBUG CacheSynchronization - transaction after completion callback, status: 3 14:09:48 DEBUG SessionImpl - after transaction completion 14:09:48 DEBUG CacheSynchronization - automatically closing session 14:09:48 DEBUG SessionImpl - automatically closing session 14:10:10 DEBUG SessionImpl - closing session org.hibernate.SessionException: Session is closed! at org.hibernate.impl.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:49) at org.hibernate.impl.SessionImpl.getTransaction(SessionImpl.java:1281) at org.hibernate.ejb.AbstractEntityManagerImpl$1.afterCompletion(AbstractEntityManagerImpl.java:496) at com.evermind.server.ApplicationServerTransaction.callSynchronizationAfterCompletion(ApplicationServerTransaction.jav a:1074) at com.evermind.server.ApplicationServerTransactionManager.freeResources(ApplicationServerTransactionManager.java:355) at com.evermind.server.ApplicationServerTransaction.doCommit(ApplicationServerTransaction.java:249) at com.evermind.server.ApplicationServerTransaction.commit(ApplicationServerTransaction.java:126) at com.evermind.server.ApplicationServerTransactionManager.commit(ApplicationServerTransactionManager.java:433) at com.evermind.server.ApplicationServer$2.commit(ApplicationServer.java:4540) at com.evermind.server.ejb.EJBTransactionManager.end(EJBTransactionManager.java:136) at com.evermind.server.ejb.interceptor.system.TxRequiredInterceptor.invoke(TxRequiredInterceptor.java:63) at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69) at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52) at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69) at com.evermind.server.ejb.StatelessSessionEJBObject.OC4J_invokeMethod(StatelessSessionEJBObject.java:86) at IEJBEventDispatcherSBLocal_StatelessSessionBeanWrapper62.dispatchEvent(IEJBEventDispatcherSBLocal_StatelessSessionBe anWrapper62.java:37) at com.senior.web.shared.EJBEventDispatcher.dispatchEvent(EJBEventDispatcher.java:49) at com.senior.web.faces.bean.administration.StudentParentDirectorySetupFace.load(StudentParentDirectorySetupFace.java:4 5)
    via by Jifeng Liu,
  • I got an exception as the summary. I add some related debug information and stack trace at the end. I am using a JTA EntityManager associated with current container managed transaction in a J2EE server. This happends when the stateless session bean finishs its excution. When current transaction commits, the current Session is closed by CacheSynchronization class. Then AbstractEntityManagerImpl$1.afterCompletion() method is called. this method trys to get transaction in the closed session object and causes the exception. 14:09:48 DEBUG AbstractFlushingEventListener - executing flush 14:09:48 DEBUG AbstractFlushingEventListener - post flush 14:09:48 DEBUG CacheSynchronization - transaction after completion callback, status: 3 14:09:48 DEBUG SessionImpl - after transaction completion 14:09:48 DEBUG CacheSynchronization - automatically closing session 14:09:48 DEBUG SessionImpl - automatically closing session 14:10:10 DEBUG SessionImpl - closing session org.hibernate.SessionException: Session is closed! at org.hibernate.impl.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:49) at org.hibernate.impl.SessionImpl.getTransaction(SessionImpl.java:1281) at org.hibernate.ejb.AbstractEntityManagerImpl$1.afterCompletion(AbstractEntityManagerImpl.java:496) at com.evermind.server.ApplicationServerTransaction.callSynchronizationAfterCompletion(ApplicationServerTransaction.jav a:1074) at com.evermind.server.ApplicationServerTransactionManager.freeResources(ApplicationServerTransactionManager.java:355) at com.evermind.server.ApplicationServerTransaction.doCommit(ApplicationServerTransaction.java:249) at com.evermind.server.ApplicationServerTransaction.commit(ApplicationServerTransaction.java:126) at com.evermind.server.ApplicationServerTransactionManager.commit(ApplicationServerTransactionManager.java:433) at com.evermind.server.ApplicationServer$2.commit(ApplicationServer.java:4540) at com.evermind.server.ejb.EJBTransactionManager.end(EJBTransactionManager.java:136) at com.evermind.server.ejb.interceptor.system.TxRequiredInterceptor.invoke(TxRequiredInterceptor.java:63) at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69) at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52) at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69) at com.evermind.server.ejb.StatelessSessionEJBObject.OC4J_invokeMethod(StatelessSessionEJBObject.java:86) at IEJBEventDispatcherSBLocal_StatelessSessionBeanWrapper62.dispatchEvent(IEJBEventDispatcherSBLocal_StatelessSessionBe anWrapper62.java:37) at com.senior.web.shared.EJBEventDispatcher.dispatchEvent(EJBEventDispatcher.java:49) at com.senior.web.faces.bean.administration.StudentParentDirectorySetupFace.load(StudentParentDirectorySetupFace.java:4 5)
    via by Jifeng Liu,
  • Administrator Guide
    via by Unknown author,
  • 2.2.2. FAQs of database configuration
    via by Unknown author,
  • Hibernate Session closed problem!
    via Stack Overflow by Saher Ahwal
    ,
    • org.hibernate.SessionException: Session is closed! at org.hibernate.impl.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:49) at org.hibernate.impl.SessionImpl.getTransaction(SessionImpl.java:1281) at org.hibernate.ejb.AbstractEntityManagerImpl$1.afterCompletion(AbstractEntityManagerImpl.java:496) at com.evermind.server.ApplicationServerTransaction.callSynchronizationAfterCompletion(ApplicationServerTransaction.java:1074) at com.evermind.server.ApplicationServerTransactionManager.freeResources(ApplicationServerTransactionManager.java:355) at com.evermind.server.ApplicationServerTransaction.doCommit(ApplicationServerTransaction.java:249) at com.evermind.server.ApplicationServerTransaction.commit(ApplicationServerTransaction.java:126) at com.evermind.server.ApplicationServerTransactionManager.commit(ApplicationServerTransactionManager.java:433) at com.evermind.server.ApplicationServer$2.commit(ApplicationServer.java:4540) at com.evermind.server.ejb.EJBTransactionManager.end(EJBTransactionManager.java:136) at com.evermind.server.ejb.interceptor.system.TxRequiredInterceptor.invoke(TxRequiredInterceptor.java:63) at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69) at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52) at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69) at com.evermind.server.ejb.StatelessSessionEJBObject.OC4J_invokeMethod(StatelessSessionEJBObject.java:86) at IEJBEventDispatcherSBLocal_StatelessSessionBeanWrapper62.dispatchEvent(IEJBEventDispatcherSBLocal_StatelessSessionBeanWrapper62.java:37) at com.senior.web.shared.EJBEventDispatcher.dispatchEvent(EJBEventDispatcher.java:49) at com.senior.web.faces.bean.administration.StudentParentDirectorySetupFace.load(StudentParentDirectorySetupFace.java:45)
    No Bugmate found.