-
Notifications
You must be signed in to change notification settings - Fork 799
ClassNotFoundException
when calling a FeignBlockingLoadBalancerClient
in a parallel stream (multiple threads)
#600
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Spring Cloud: |
@didiez Have you tried this with various jdks? Do you get this issue always or only while running with a specific jdk? |
Yes, the issue is reproducible at least with the following jdks:
|
As a hacky workaround, we have registered a custom @Bean
@ConditionalOnMissingBean
public LoadBalancerClientFactory loadBalancerClientFactory(ObjectProvider<List<LoadBalancerClientSpecification>> configurations) {
LoadBalancerClientFactory clientFactory = new LoadBalancerClientFactory(){
@Override
protected AnnotationConfigApplicationContext createContext(String name) {
// FIXME: temporary switch classloader to use the correct one when creating the context
ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
AnnotationConfigApplicationContext context = super.createContext(name);
Thread.currentThread().setContextClassLoader(originalClassLoader);
return context;
}
};
clientFactory.setConfigurations(configurations.getIfAvailable(Collections::emptyList));
return clientFactory;
} |
Ok, thanks for the update. This looks like a duplicate of #475. |
Describe the bug
When calling a
@FeignClient
(FeignBlockingLoadBalancerClient
) in a parallel stream (stream.parallel()
), the following error arises, only when executing it as an uber/executablejar
.It seems to be related (kind of) to some other
ClassLoader
issues (spring-projects/spring-boot#24836, spring-projects/spring-boot#15737 )Sample
Sample application with the steps to reproduce the problem https://github.com/didiez/feign-parallel-classloader-bug
The text was updated successfully, but these errors were encountered: