org.hibernate.SessionException: Session is closed!

XWiki.org JIRA | Anca Luca | 7 years ago
  1. 0

    Sometimes this error occurs when calling the XWikiService related functions: {code} com.xpn.xwiki.XWikiException: Error number 3223 in 3: Exception while searching documents with sql select distinct doc from XWikiDocument as doc where lower(doc.title) like '%%' or lower(doc.fullName) like '%%' Wrapped Exception: Session is closed! at com.xpn.xwiki.store.XWikiHibernateStore.search(XWikiHibernateStore.java:2142) at com.xpn.xwiki.store.XWikiHibernateStore.search(XWikiHibernateStore.java:2072) at com.xpn.xwiki.store.XWikiHibernateStore.search(XWikiHibernateStore.java:2061) at com.xpn.xwiki.store.XWikiCacheStore.search(XWikiCacheStore.java:581) at com.xpn.xwiki.XWiki.search(XWiki.java:1565) at com.xpn.xwiki.wysiwyg.server.DefaultWysiwygService.getMatchingPages(DefaultWysiwygService.java:432) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:527) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:166) at com.xpn.xwiki.gwt.api.server.XWikiServiceImpl.processCall(XWikiServiceImpl.java:85) at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:86) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:117) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1148) at com.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:68) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1148) at com.xpn.xwiki.web.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:295) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1148) at com.xpn.xwiki.web.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:112) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1148) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:387) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417) at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:879) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:747) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520) Wrapped Exception: org.hibernate.SessionException: Session is closed! at org.hibernate.impl.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:49) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1110) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79) at com.xpn.xwiki.store.XWikiHibernateStore.search(XWikiHibernateStore.java:2134) at com.xpn.xwiki.store.XWikiHibernateStore.search(XWikiHibernateStore.java:2072) at com.xpn.xwiki.store.XWikiHibernateStore.search(XWikiHibernateStore.java:2061) at com.xpn.xwiki.store.XWikiCacheStore.search(XWikiCacheStore.java:581) at com.xpn.xwiki.XWiki.search(XWiki.java:1565) at com.xpn.xwiki.wysiwyg.server.DefaultWysiwygService.getMatchingPages(DefaultWysiwygService.java:432) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:527) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:166) at com.xpn.xwiki.gwt.api.server.XWikiServiceImpl.processCall(XWikiServiceImpl.java:85) at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:86) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:117) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1148) at com.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:68) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1148) at com.xpn.xwiki.web.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:295) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1148) at com.xpn.xwiki.web.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:112) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1148) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:387) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417) at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:879) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:747) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520) {code} which is tipically the error when the same context is shared by 2 different threads. In the XWikiServiceImpl context preparing code, the prepared context is stored as a member of the service servlet to be retrieved afterwards in the called function, which makes it shared by 2 threads if 2 calls to the service are made simultaneously.

    XWiki.org JIRA | 7 years ago | Anca Luca
    org.hibernate.SessionException: Session is closed!
  2. 0

    AppFuse - User - Appfuse Core + Swing: Session is closed

    nabble.com | 7 months ago
    org.hibernate.SessionException: Session is closed!
  3. 0

    RabbitMQ for ES

    Google Groups | 5 years ago | thomas
    org.hibernate.SessionException: Session is closed!
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    ES and Spring 3

    Google Groups | 5 years ago | thomas
    org.hibernate.SessionException: Session is closed!
  6. 0

    Sping+JPA+Hibernate(Erro Session Closed!)-listarTodos()-Livro Dominando JSF e Spring, Hibernate(AJUDA URGENTE)

    Google Groups | 7 years ago | Ricardo Lacerda
    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
      QueryImpl.list
      1. org.hibernate.impl.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:49)
      2. org.hibernate.impl.SessionImpl.list(SessionImpl.java:1110)
      3. org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
      3 frames
    3. com.xpn.xwiki
      DefaultWysiwygService.getMatchingPages
      1. com.xpn.xwiki.store.XWikiHibernateStore.search(XWikiHibernateStore.java:2134)
      2. com.xpn.xwiki.store.XWikiHibernateStore.search(XWikiHibernateStore.java:2072)
      3. com.xpn.xwiki.store.XWikiHibernateStore.search(XWikiHibernateStore.java:2061)
      4. com.xpn.xwiki.store.XWikiCacheStore.search(XWikiCacheStore.java:581)
      5. com.xpn.xwiki.XWiki.search(XWiki.java:1565)
      6. com.xpn.xwiki.wysiwyg.server.DefaultWysiwygService.getMatchingPages(DefaultWysiwygService.java:432)
      6 frames
    4. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:585)
      4 frames
    5. Jetty Contrib :: jetty-gwt RemoteServiceServlet
      RemoteServiceServlet.processCall
      1. com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:527)
      2. com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:166)
      2 frames
    6. com.xpn.xwiki
      XWikiServiceImpl.processCall
      1. com.xpn.xwiki.gwt.api.server.XWikiServiceImpl.processCall(XWikiServiceImpl.java:85)
      1 frame
    7. Jetty Contrib :: jetty-gwt RemoteServiceServlet
      RemoteServiceServlet.doPost
      1. com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:86)
      1 frame
    8. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
      2. javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      2 frames
    9. Jetty Server
      ServletHandler$CachedChain.doFilter
      1. org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
      2. org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
      2 frames
    10. com.xpn.xwiki
      ActionFilter.doFilter
      1. com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:117)
      1 frame
    11. Jetty Server
      ServletHandler$CachedChain.doFilter
      1. org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1148)
      1 frame
    12. com.xpn.xwiki
      XWikiDavFilter.doFilter
      1. com.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:68)
      1 frame
    13. Jetty Server
      ServletHandler$CachedChain.doFilter
      1. org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1148)
      1 frame
    14. com.xpn.xwiki
      SavedRequestRestorerFilter.doFilter
      1. com.xpn.xwiki.web.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:295)
      1 frame
    15. Jetty Server
      ServletHandler$CachedChain.doFilter
      1. org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1148)
      1 frame
    16. com.xpn.xwiki
      SetCharacterEncodingFilter.doFilter
      1. com.xpn.xwiki.web.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:112)
      1 frame
    17. Jetty Server
      SelectChannelEndPoint.run
      1. org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1148)
      2. org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:387)
      3. org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
      4. org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
      5. org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
      6. org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417)
      7. org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
      8. org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
      9. org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      10. org.mortbay.jetty.Server.handle(Server.java:326)
      11. org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
      12. org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:879)
      13. org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:747)
      14. org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
      15. org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
      16. org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
      16 frames
    18. Jetty Util
      QueuedThreadPool$PoolThread.run
      1. org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520)
      1 frame