业务:
通过canal监听数据,放入Kafka处理业务,再远程feign调用。
异常:
org.springframework.beans.factory.support.ScopeNotActiveException: 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: In this case, use RequestContextListener or RequestContextFilter to expose the current request
原因解析:
通过以上报错信息,分析出该错误是因为非web请求方式调用feign失败,因为我们在调用微服务接口时,一般情况下,我们都是在web接口里的具体实现方法通过feign来调用,也就是说,无论怎么样我们的最外层都是有一个web请求来搭建桥梁的,但是本次业务逻辑使用canal监听放入kafka处理的方式,也就是说我们从项目一run起来就会执行,所以导致我们


998

被折叠的 条评论
为什么被折叠?



