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.

GitHub | bilak | 7 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

    FEIGN + OAUTH2 calls from another thread not propagating security

    GitHub | 7 months ago | bilak
    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

    service to service communication through Resttemplate with Spring cloud(Oauth 2)

    Stack Overflow | 11 months ago | Brijan Elwadhi
    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

    Unable to override "request" scope using CustomScopeConfigurer nor ApplicationContextInitializer

    GitHub | 2 years ago | ceefour
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sysConfig' defined in class id.co.bippo.common.BippoSysConfigConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [id.co.bippo.common.BippoSysConfig]: Factory method 'sysConfig' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.tenantRef': Scope 'request' 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

    Spring RequestContextListenerrequestDestroyed called before request thread finishes

    Stack Overflow | 10 months ago | jonas.hartwig
    java.lang.IllegalStateException: Cannot ask for request attribute - request is not active anymore!
  6. 0

    Spring deferred result & request scoped bean(Oauth2ClientContext) in the web filter

    Stack Overflow | 2 years ago
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.oauth2ClientContext': Scope 'request' 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 6 months ago
9 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
    AbstractRequestAttributesScope.get
    1. org.springframework.web.context.request.RequestContextHolder.currentRequestAttributes(RequestContextHolder.java:131)[spring-web-4.3.2.RELEASE.jar:4.3.2.RELEASE]
    2. org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:41)[spring-web-4.3.2.RELEASE.jar:4.3.2.RELEASE]
    2 frames
  3. Spring Beans
    AbstractBeanFactory.getBean
    1. org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:340)[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
    2. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
    2 frames
  4. Spring AOP
    JdkDynamicAopProxy.invoke
    1. org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.java:35)[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE]
    2. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:192)[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE]
    2 frames
  5. com.sun.proxy
    $Proxy106.getAccessToken
    1. com.sun.proxy.$Proxy106.getAccessToken(Unknown Source)[na:na]
    1 frame
  6. org.springframework.cloud
    OAuth2FeignRequestInterceptor.apply
    1. org.springframework.cloud.security.oauth2.client.feign.OAuth2FeignRequestInterceptor.getToken(OAuth2FeignRequestInterceptor.java:124)[spring-cloud-security-1.1.2.RELEASE.jar:1.1.2.RELEASE]
    2. org.springframework.cloud.security.oauth2.client.feign.OAuth2FeignRequestInterceptor.extract(OAuth2FeignRequestInterceptor.java:112)[spring-cloud-security-1.1.2.RELEASE.jar:1.1.2.RELEASE]
    3. org.springframework.cloud.security.oauth2.client.feign.OAuth2FeignRequestInterceptor.apply(OAuth2FeignRequestInterceptor.java:100)[spring-cloud-security-1.1.2.RELEASE.jar:1.1.2.RELEASE]
    3 frames
  7. feign-core
    ReflectiveFeign$FeignInvocationHandler.invoke
    1. feign.SynchronousMethodHandler.targetRequest(SynchronousMethodHandler.java:154)[feign-core-8.16.2.jar:8.16.2]
    2. feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:88)[feign-core-8.16.2.jar:8.16.2]
    3. feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:76)[feign-core-8.16.2.jar:8.16.2]
    4. feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:103)[feign-core-8.16.2.jar:8.16.2]
    4 frames
  8. com.sun.proxy
    $Proxy107.getDefinedEntries
    1. com.sun.proxy.$Proxy107.getDefinedEntries(Unknown Source)[na:na]
    1 frame
  9. com.github.bilak
    SampleController$SampleServiceClientCaller.call
    1. com.github.bilak.poc.hystrix_oauth2_feign.api.rest.SampleController$SampleServiceClientCaller.call(SampleController.java:69)[classes/:na]
    2. com.github.bilak.poc.hystrix_oauth2_feign.api.rest.SampleController$SampleServiceClientCaller.call(SampleController.java:58)[classes/:na]
    2 frames
  10. org.springframework.security
    DelegatingSecurityContextCallable.call
    1. org.springframework.security.concurrent.DelegatingSecurityContextCallable.call(DelegatingSecurityContextCallable.java:86)[spring-security-core-4.1.1.RELEASE.jar:4.1.1.RELEASE]
    1 frame
  11. Java RT
    Thread.run
    1. java.util.concurrent.FutureTask.run(FutureTask.java:266)[na:1.8.0_77]
    2. java.lang.Thread.run(Thread.java:745)[na:1.8.0_77]
    2 frames