今天写springcloud项目的时候碰到一个很坑的报错:
Correct the classpath of your application so that it contains a single, compatible version of reactor.netty.resources.ConnectionProvider
大致意思就是jar包各种依赖关系不兼容,完整报错如下
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-04-02 14:18:39.523 ERROR 94512 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.springframework.cloud.gateway.config.GatewayAutoConfiguration$NettyConfiguration.gatewayHttpClient(GatewayAutoConfiguration.java:622)
The following method did not exist:
reactor.netty.resources.ConnectionProvider.elastic(Ljava/lang/String;Ljava/time/Duration;Ljava/time/Duration;)Lreactor/netty/resources/ConnectionProvider;
The method's class, reactor.netty.resources.ConnectionProvider, is available from the following locations:
jar:file:/D:/Program%20Files/repository/io/projectreactor/netty/reactor-netty/0.9.2.RELEASE/reactor-netty-0.9.2.RELEASE.jar!/reactor/netty/resources/ConnectionProvider.class
It was loaded from the following location:
file:/D:/Program%20Files/repository/io/projectreactor/netty/reactor-netty/0.9.2.RELEASE/reactor-netty-0.9.2.RELEASE.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of reactor.netty.resources.ConnectionProvider
Process finished with exit code 1
pom文档导入的依赖如下:
springboot版本是2.2.2.release,springcloud版本是Hoxton.SR8,两个版本不兼容
最后把springboot和springcloud版本调整成互相兼容的版本,再启动项目就不报错了