org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.appContext': 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.

Stack Overflow | SpeedDragon | 5 months 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

    Update to Spring Boot 1.4.1 from 1.3.2 breaks interceptor

    Stack Overflow | 5 months ago | SpeedDragon
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.appContext': 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.
  2. 0

    Testing with autowired dependency like session in Validator

    Stack Overflow | 3 years ago | Alishazy
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.clientSession': 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.
  3. 0

    Error creating bean scoped in spring application using Neo4j and Scheduled processes

    GitHub | 10 months ago | zeroberto
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.getSession': 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

    Hystrix/Ribbon got error when using OAuth2

    GitHub | 8 months ago | tonny1983
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.oauth2ClientContext': 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

    How to implements Application Listener on spring 4.3.2

    Stack Overflow | 5 months ago | Iwan Ivanto
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.getSession': 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.

  1. Andreas Häber 1 times, last 4 months ago
  2. serious2monkeys 6 times, last 7 months ago
4 unregistered visitors
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. 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.

    at org.springframework.web.context.request.RequestContextHolder.currentRequestAttributes()
  2. Spring
    SessionScope.get
    1. org.springframework.web.context.request.RequestContextHolder.currentRequestAttributes(RequestContextHolder.java:131)
    2. org.springframework.web.context.request.SessionScope.get(SessionScope.java:91)
    2 frames
  3. Spring Beans
    AbstractBeanFactory.getBean
    1. org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:340)
    2. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    2 frames
  4. Spring AOP
    CglibAopProxy$DynamicAdvisedInterceptor.intercept
    1. org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.java:35)
    2. org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.getTarget(CglibAopProxy.java:687)
    3. org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:637)
    3 frames
  5. com.xxx
    AppContext$$EnhancerBySpringCGLIB$$c81ccd31.getIpAddress
    1. com.xxx.AppContext$$EnhancerBySpringCGLIB$$c81ccd31.getIpAddress(<generated>)
    1 frame
  6. com.xxx.api
    OAuthInterceptor.apply
    1. com.xxx.api.interceptor.OAuthInterceptor.apply(OAuthInterceptor.java:34)
    1 frame
  7. feign-core
    SynchronousMethodHandler.invoke
    1. feign.SynchronousMethodHandler.targetRequest(SynchronousMethodHandler.java:158)
    2. feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:88)
    3. feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:76)
    3 frames
  8. feign.hystrix
    HystrixInvocationHandler$1.run
    1. feign.hystrix.HystrixInvocationHandler$1.run(HystrixInvocationHandler.java:108)
    1 frame
  9. hystrix-core
    HystrixCommand$1.call
    1. com.netflix.hystrix.HystrixCommand$1.call(HystrixCommand.java:294)
    2. com.netflix.hystrix.HystrixCommand$1.call(HystrixCommand.java:289)
    2 frames
  10. rxjava
    Observable.unsafeSubscribe
    1. rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
    2. rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
    3. rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
    4. rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
    5. rx.Observable.unsafeSubscribe(Observable.java:10211)
    6. rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41)
    7. rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30)
    8. rx.Observable.unsafeSubscribe(Observable.java:10211)
    8 frames
  11. hystrix-core
    AbstractCommand$5.call
    1. com.netflix.hystrix.AbstractCommand$5.call(AbstractCommand.java:521)
    2. com.netflix.hystrix.AbstractCommand$5.call(AbstractCommand.java:499)
    2 frames
  12. rxjava
    OperatorSubscribeOn$1.call
    1. rx.Observable.unsafeSubscribe(Observable.java:10211)
    2. rx.internal.operators.OperatorSubscribeOn$1.call(OperatorSubscribeOn.java:94)
    2 frames
  13. hystrix-core
    HystrixContexSchedulerAction.call
    1. com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:56)
    2. com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:47)
    3. com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction.call(HystrixContexSchedulerAction.java:69)
    3 frames
  14. rxjava
    ScheduledAction.run
    1. rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
    1 frame
  15. Java RT
    Thread.run
    1. java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    2. java.util.concurrent.FutureTask.run(FutureTask.java:266)
    3. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    4. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    5. java.lang.Thread.run(Thread.java:745)
    5 frames