java.lang.RuntimeException: java.lang.IllegalStateException: No value for key [org.hibernate.internal.SessionFactoryImpl@28af7fd7] bound to thread [http-bio-8080-exec-1]] with root cause java.lang.IllegalStateException: No value for key [org.hibernate.internal.SessionFactoryImpl@28af7fd7] bound to thread [http-bio-8080-exec-1]

Spring JIRA | Stig Runar Vangen | 3 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    In a controller I return a DeferredResult in order to set up an async request. From an another thread I set the result of DeferredResult, and thus return the result back to the user. The problem lies in that I also use a OpenSessionInViewFilter for Hibernate session management. This filter gives an error now and then indicating that a session is not bound to the current thread. Stack trace is as follows: {code} 29.aug.2013 11:15:57 [http-bio-8080-exec-1] ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/].[appServlet] - Servlet.service() for servlet appServlet threw exception java.lang.IllegalStateException: No value for key [org.hibernate.internal.SessionFactoryImpl@28af7fd7] bound to thread [http-bio-8080-exec-1] at org.springframework.transaction.support.TransactionSynchronizationManager.unbindResource(TransactionSynchronizationManager.java:209) at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:157) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749) at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:660) at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:626) at org.apache.catalina.core.AsyncContextImpl$1.run(AsyncContextImpl.java:225) at org.apache.catalina.core.AsyncContextImpl.doInternalDispatch(AsyncContextImpl.java:367) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:217) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.asyncDispatch(CoyoteAdapter.java:299) at org.apache.coyote.http11.AbstractHttp11Processor.asyncDispatch(AbstractHttp11Processor.java:1587) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:722) 29.aug.2013 11:15:57 [http-bio-8080-exec-1] ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/].[appServlet] - Servlet.service() for servlet [appServlet] in context with path [] threw exception [java.lang.RuntimeException: java.lang.IllegalStateException: No value for key [org.hibernate.internal.SessionFactoryImpl@28af7fd7] bound to thread [http-bio-8080-exec-1]] with root cause java.lang.IllegalStateException: No value for key [org.hibernate.internal.SessionFactoryImpl@28af7fd7] bound to thread [http-bio-8080-exec-1] at org.springframework.transaction.support.TransactionSynchronizationManager.unbindResource(TransactionSynchronizationManager.java:209) at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:157) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749) at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:660) at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:626) at org.apache.catalina.core.AsyncContextImpl$1.run(AsyncContextImpl.java:225) at org.apache.catalina.core.AsyncContextImpl.doInternalDispatch(AsyncContextImpl.java:367) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:217) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.asyncDispatch(CoyoteAdapter.java:299) at org.apache.coyote.http11.AbstractHttp11Processor.asyncDispatch(AbstractHttp11Processor.java:1587) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:722) {code}

    Spring JIRA | 3 years ago | Stig Runar Vangen
    java.lang.RuntimeException: java.lang.IllegalStateException: No value for key [org.hibernate.internal.SessionFactoryImpl@28af7fd7] bound to thread [http-bio-8080-exec-1]] with root cause java.lang.IllegalStateException: No value for key [org.hibernate.internal.SessionFactoryImpl@28af7fd7] bound to thread [http-bio-8080-exec-1]
  2. 0

    In a controller I return a DeferredResult in order to set up an async request. From an another thread I set the result of DeferredResult, and thus return the result back to the user. The problem lies in that I also use a OpenSessionInViewFilter for Hibernate session management. This filter gives an error now and then indicating that a session is not bound to the current thread. Stack trace is as follows: {code} 29.aug.2013 11:15:57 [http-bio-8080-exec-1] ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/].[appServlet] - Servlet.service() for servlet appServlet threw exception java.lang.IllegalStateException: No value for key [org.hibernate.internal.SessionFactoryImpl@28af7fd7] bound to thread [http-bio-8080-exec-1] at org.springframework.transaction.support.TransactionSynchronizationManager.unbindResource(TransactionSynchronizationManager.java:209) at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:157) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749) at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:660) at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:626) at org.apache.catalina.core.AsyncContextImpl$1.run(AsyncContextImpl.java:225) at org.apache.catalina.core.AsyncContextImpl.doInternalDispatch(AsyncContextImpl.java:367) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:217) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.asyncDispatch(CoyoteAdapter.java:299) at org.apache.coyote.http11.AbstractHttp11Processor.asyncDispatch(AbstractHttp11Processor.java:1587) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:722) 29.aug.2013 11:15:57 [http-bio-8080-exec-1] ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/].[appServlet] - Servlet.service() for servlet [appServlet] in context with path [] threw exception [java.lang.RuntimeException: java.lang.IllegalStateException: No value for key [org.hibernate.internal.SessionFactoryImpl@28af7fd7] bound to thread [http-bio-8080-exec-1]] with root cause java.lang.IllegalStateException: No value for key [org.hibernate.internal.SessionFactoryImpl@28af7fd7] bound to thread [http-bio-8080-exec-1] at org.springframework.transaction.support.TransactionSynchronizationManager.unbindResource(TransactionSynchronizationManager.java:209) at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:157) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749) at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:660) at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:626) at org.apache.catalina.core.AsyncContextImpl$1.run(AsyncContextImpl.java:225) at org.apache.catalina.core.AsyncContextImpl.doInternalDispatch(AsyncContextImpl.java:367) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:217) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.asyncDispatch(CoyoteAdapter.java:299) at org.apache.coyote.http11.AbstractHttp11Processor.asyncDispatch(AbstractHttp11Processor.java:1587) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:722) {code}

    Spring JIRA | 3 years ago | Stig Runar Vangen
    java.lang.RuntimeException: java.lang.IllegalStateException: No value for key [org.hibernate.internal.SessionFactoryImpl@28af7fd7] bound to thread [http-bio-8080-exec-1]] with root cause java.lang.IllegalStateException: No value for key [org.hibernate.internal.SessionFactoryImpl@28af7fd7] bound to thread [http-bio-8080-exec-1]

    Root Cause Analysis

    1. java.lang.RuntimeException

      java.lang.IllegalStateException: No value for key [org.hibernate.internal.SessionFactoryImpl@28af7fd7] bound to thread [http-bio-8080-exec-1]] with root cause java.lang.IllegalStateException: No value for key [org.hibernate.internal.SessionFactoryImpl@28af7fd7] bound to thread [http-bio-8080-exec-1]

      at org.springframework.transaction.support.TransactionSynchronizationManager.unbindResource()
    2. Spring Tx
      TransactionSynchronizationManager.unbindResource
      1. org.springframework.transaction.support.TransactionSynchronizationManager.unbindResource(TransactionSynchronizationManager.java:209)
      1 frame
    3. Spring ORM
      OpenSessionInViewFilter.doFilterInternal
      1. org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:157)
      1 frame
    4. Spring
      OncePerRequestFilter.doFilter
      1. org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
      1 frame
    5. Glassfish Core
      CoyoteAdapter.asyncDispatch
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      3. org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
      4. org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:660)
      5. org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:626)
      6. org.apache.catalina.core.AsyncContextImpl$1.run(AsyncContextImpl.java:225)
      7. org.apache.catalina.core.AsyncContextImpl.doInternalDispatch(AsyncContextImpl.java:367)
      8. org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:217)
      9. org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
      10. org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      11. org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      12. org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
      13. org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      14. org.apache.catalina.connector.CoyoteAdapter.asyncDispatch(CoyoteAdapter.java:299)
      14 frames
    6. Grizzly HTTP
      JIoEndpoint$SocketProcessor.run
      1. org.apache.coyote.http11.AbstractHttp11Processor.asyncDispatch(AbstractHttp11Processor.java:1587)
      2. org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:583)
      3. org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
      3 frames
    7. Java RT
      Thread.run
      1. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      2. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      3. java.lang.Thread.run(Thread.java:722)
      3 frames