org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.localizationManagerImpl': Scope 'session' is not active for the current thread; ... In my concrete case, applicationManagerImpl tries to remove an event listener from localizationManagerImpl. Of course, he only knows about the interface, so he is not aware of the fact that localizationManagerImpl is also session scoped (deregistration of listener is not really necessary). The problem is caused by the missing HttpServletRequest, which usually carries the session. When sessions expire, no request is active, so the RequestContextHolder has no RequestAttributes

Spring JIRA | Sebastian Paul | 4 years ago
  1. 0

    Destroy method of session scoped bean cannot access other session scoped bean: CommonAnnotationBeanPostProcessor - postProcessBeforeDestruction - Invocation of destroy method failed on bean with name 'scopedTarget.applicationManagerImpl': org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.localizationManagerImpl': Scope 'session' is not active for the current thread; ... In my concrete case, applicationManagerImpl tries to remove an event listener from localizationManagerImpl. Of course, he only knows about the interface, so he is not aware of the fact that localizationManagerImpl is also session scoped (deregistration of listener is not really necessary). The problem is caused by the missing HttpServletRequest, which usually carries the session. When sessions expire, no request is active, so the RequestContextHolder has no RequestAttributes at org.springframework.web.context.request.DestructionCallbackBindingListener.valueUnbound(DestructionCallbackBindingListener.java:51) [spring-web-3.1.2.RELEASE.jar:3.1.2.RELEASE] at org.apache.catalina.session.StandardSession.removeAttributeInternal(StandardSession.java:1710) [catalina.jar:6.0.35.B] at org.apache.catalina.session.StandardSession.expire(StandardSession.java:812) [catalina.jar:6.0.35.B] at org.apache.catalina.session.StandardSession.isValid(StandardSession.java:587) [catalina.jar:6.0.35.B] at org.apache.catalina.session.ManagerBase.processExpires(ManagerBase.java:714) [catalina.jar:6.0.35.B] at org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.java:699) [catalina.jar:6.0.35.B] at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1368) [catalina.jar:6.0.35.B] at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1653) [catalina.jar:6.0.35.B] at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1662) [catalina.jar:6.0.35.B] at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1662) [catalina.jar:6.0.35.B] at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1642) [catalina.jar:6.0.35.B] Spring should handle this by setting up a RequestAttributes instance which carries the session which is passed to org.springframework.web.context.request.DestructionCallbackBindingListener.valueUnbound(HttpSessionBindingEvent) Then, referencing session scoped dependencies should still be possible.

    Spring JIRA | 4 years ago | Sebastian Paul
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.localizationManagerImpl': Scope 'session' is not active for the current thread; ... In my concrete case, applicationManagerImpl tries to remove an event listener from localizationManagerImpl. Of course, he only knows about the interface, so he is not aware of the fact that localizationManagerImpl is also session scoped (deregistration of listener is not really necessary). The problem is caused by the missing HttpServletRequest, which usually carries the session. When sessions expire, no request is active, so the RequestContextHolder has no RequestAttributes
  2. 0

    Destroy method of session scoped bean cannot access other session scoped bean: CommonAnnotationBeanPostProcessor - postProcessBeforeDestruction - Invocation of destroy method failed on bean with name 'scopedTarget.applicationManagerImpl': org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.localizationManagerImpl': Scope 'session' is not active for the current thread; ... In my concrete case, applicationManagerImpl tries to remove an event listener from localizationManagerImpl. Of course, he only knows about the interface, so he is not aware of the fact that localizationManagerImpl is also session scoped (deregistration of listener is not really necessary). The problem is caused by the missing HttpServletRequest, which usually carries the session. When sessions expire, no request is active, so the RequestContextHolder has no RequestAttributes at org.springframework.web.context.request.DestructionCallbackBindingListener.valueUnbound(DestructionCallbackBindingListener.java:51) [spring-web-3.1.2.RELEASE.jar:3.1.2.RELEASE] at org.apache.catalina.session.StandardSession.removeAttributeInternal(StandardSession.java:1710) [catalina.jar:6.0.35.B] at org.apache.catalina.session.StandardSession.expire(StandardSession.java:812) [catalina.jar:6.0.35.B] at org.apache.catalina.session.StandardSession.isValid(StandardSession.java:587) [catalina.jar:6.0.35.B] at org.apache.catalina.session.ManagerBase.processExpires(ManagerBase.java:714) [catalina.jar:6.0.35.B] at org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.java:699) [catalina.jar:6.0.35.B] at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1368) [catalina.jar:6.0.35.B] at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1653) [catalina.jar:6.0.35.B] at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1662) [catalina.jar:6.0.35.B] at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1662) [catalina.jar:6.0.35.B] at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1642) [catalina.jar:6.0.35.B] Spring should handle this by setting up a RequestAttributes instance which carries the session which is passed to org.springframework.web.context.request.DestructionCallbackBindingListener.valueUnbound(HttpSessionBindingEvent) Then, referencing session scoped dependencies should still be possible.

    Spring JIRA | 4 years ago | Sebastian Paul
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.localizationManagerImpl': Scope 'session' is not active for the current thread; ... In my concrete case, applicationManagerImpl tries to remove an event listener from localizationManagerImpl. Of course, he only knows about the interface, so he is not aware of the fact that localizationManagerImpl is also session scoped (deregistration of listener is not really necessary). The problem is caused by the missing HttpServletRequest, which usually carries the session. When sessions expire, no request is active, so the RequestContextHolder has no RequestAttributes
  3. 0

    Springの@Asyncで非同期処理をする - SIerだけど技術やりたいブログ

    hatenablog.com | 1 month ago
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.sessionBean': Scope 'session' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    SIerだけど技術やりたいブログ

    hatenablog.com | 1 month ago
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.sessionBean': Scope 'session' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
  6. 0

    [BISERVER-10009] Getting exception due to session is not active for current thread - Pentaho BI Platform Tracking

    pentaho.com | 11 months ago
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'IUserSettingService': Scope 'session' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.

    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.springframework.beans.factory.BeanCreationException

      Error creating bean with name 'scopedTarget.localizationManagerImpl': Scope 'session' is not active for the current thread; ... In my concrete case, applicationManagerImpl tries to remove an event listener from localizationManagerImpl. Of course, he only knows about the interface, so he is not aware of the fact that localizationManagerImpl is also session scoped (deregistration of listener is not really necessary). The problem is caused by the missing HttpServletRequest, which usually carries the session. When sessions expire, no request is active, so the RequestContextHolder has no RequestAttributes

      at org.springframework.web.context.request.DestructionCallbackBindingListener.valueUnbound()
    2. Spring
      DestructionCallbackBindingListener.valueUnbound
      1. org.springframework.web.context.request.DestructionCallbackBindingListener.valueUnbound(DestructionCallbackBindingListener.java:51)[spring-web-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      1 frame
    3. Glassfish Core
      ContainerBase$ContainerBackgroundProcessor.run
      1. org.apache.catalina.session.StandardSession.removeAttributeInternal(StandardSession.java:1710)[catalina.jar:6.0.35.B]
      2. org.apache.catalina.session.StandardSession.expire(StandardSession.java:812)[catalina.jar:6.0.35.B]
      3. org.apache.catalina.session.StandardSession.isValid(StandardSession.java:587)[catalina.jar:6.0.35.B]
      4. org.apache.catalina.session.ManagerBase.processExpires(ManagerBase.java:714)[catalina.jar:6.0.35.B]
      5. org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.java:699)[catalina.jar:6.0.35.B]
      6. org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1368)[catalina.jar:6.0.35.B]
      7. org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1653)[catalina.jar:6.0.35.B]
      8. org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1662)[catalina.jar:6.0.35.B]
      9. org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1662)[catalina.jar:6.0.35.B]
      10. org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1642)[catalina.jar:6.0.35.B]
      10 frames