Closed SirZiWang closed 5 months ago
The solution is to manually initialize the load balancer client, such as after an application ready event occurs
@Configuration
public class LoadBalanceConfig {
@Bean
@ConditionalOnMissingBean
public LoadBalancerClientFactory loadBalancerClientFactory(LoadBalancerClientsProperties properties) {
return new LoadBalancerClientFactory(properties) {
@Override
public AnnotationConfigApplicationContext createContext(String name) {
ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
AnnotationConfigApplicationContext context = (AnnotationConfigApplicationContext) super.createContext(name);
Thread.currentThread().setContextClassLoader(originalClassLoader);
return context;
}
};
}
}
Hello @SirZiWang , thanks for reporting the issue. This looks like a duplicate of https://github.com/spring-cloud/spring-cloud-openfeign/issues/475. The versions of Spring libraries that you're using are no longer in OSS support. Please upgrade to Spring Cloud 2023.0.1
and Boot 3.2.2
, but manually set Spring Cloud Commons version to 4.1.1
to avoid a different known regression, and verify. The issue should not be there. If you're still facing the issue after the upgrade, please get back to us.
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.
Describe the bug Describe the bug spring-boot 3.0.5 spring-cloud 2022.0.0 spring-cloud-alibaba 2022.0.0.0-RC1 openfeign 3.8.0
error stack
Sample
I was calling other services through openFeign in a synchronous parallel task, and this exception occurred on some of the requests.
This happens from time a time, not in regular way.
Thank you for your help.