org.hibernate.SessionException: Session is closed!

Hibernate JIRA | Jifeng Liu | 1 decade ago
  1. 0

    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)

    Hibernate JIRA | 1 decade ago | Jifeng Liu
    org.hibernate.SessionException: Session is closed!
  2. 0

    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)

    Hibernate JIRA | 1 decade ago | Jifeng Liu
    org.hibernate.SessionException: Session is closed!
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    Administrator Guide

    jboss.com | 1 year ago
    org.hibernate.SessionException: Session is closed!
  5. 0

    GlassFish Users - org.hibernate.SessionException:Session is closed!

    nabble.com | 7 months ago
    javax.persistence.PersistenceException: org.hibernate.SessionException: Session is closed!

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.hibernate.SessionException

      Session is closed!

      at org.hibernate.impl.AbstractSessionImpl.errorIfClosed()
    2. Hibernate
      SessionImpl.getTransaction
      1. org.hibernate.impl.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:49)
      2. org.hibernate.impl.SessionImpl.getTransaction(SessionImpl.java:1281)
      2 frames
    3. Hibernate EJB
      AbstractEntityManagerImpl$1.afterCompletion
      1. org.hibernate.ejb.AbstractEntityManagerImpl$1.afterCompletion(AbstractEntityManagerImpl.java:496)
      1 frame
    4. com.evermind.server
      StatelessSessionEJBObject.OC4J_invokeMethod
      1. com.evermind.server.ApplicationServerTransaction.callSynchronizationAfterCompletion(ApplicationServerTransaction.java:1074)
      2. com.evermind.server.ApplicationServerTransactionManager.freeResources(ApplicationServerTransactionManager.java:355)
      3. com.evermind.server.ApplicationServerTransaction.doCommit(ApplicationServerTransaction.java:249)
      4. com.evermind.server.ApplicationServerTransaction.commit(ApplicationServerTransaction.java:126)
      5. com.evermind.server.ApplicationServerTransactionManager.commit(ApplicationServerTransactionManager.java:433)
      6. com.evermind.server.ApplicationServer$2.commit(ApplicationServer.java:4540)
      7. com.evermind.server.ejb.EJBTransactionManager.end(EJBTransactionManager.java:136)
      8. com.evermind.server.ejb.interceptor.system.TxRequiredInterceptor.invoke(TxRequiredInterceptor.java:63)
      9. com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
      10. com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
      11. com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
      12. com.evermind.server.ejb.StatelessSessionEJBObject.OC4J_invokeMethod(StatelessSessionEJBObject.java:86)
      12 frames
    5. Unknown
      IEJBEventDispatcherSBLocal_StatelessSessionBeanWrapper62.dispatchEvent
      1. IEJBEventDispatcherSBLocal_StatelessSessionBeanWrapper62.dispatchEvent(IEJBEventDispatcherSBLocal_StatelessSessionBeanWrapper62.java:37)
      1 frame
    6. com.senior.web
      StudentParentDirectorySetupFace.load
      1. com.senior.web.shared.EJBEventDispatcher.dispatchEvent(EJBEventDispatcher.java:49)
      2. com.senior.web.faces.bean.administration.StudentParentDirectorySetupFace.load(StudentParentDirectorySetupFace.java:45)
      2 frames