本篇内容主要讲解“如何解决升级boot后gateway网关出现的大量问题”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“如何解决升级boot后gateway网关出现的大量问题”吧!
项目版本
报错1:
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:612)
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:/E:/java/MAVEN/MavenRepo/io/projectreactor/netty/reactor-netty/0.9.1.RELEASE/reactor-netty-0.9.1.RELEASE.jar!/reactor/netty/resources/ConnectionProvider.class
It was loaded from the following location:
file:/E:/java/MAVEN/MavenRepo/io/projectreactor/netty/reactor-netty/0.9.1.RELEASE/reactor-netty-0.9.1.RELEASE.jar
这个错误原因是因为boot升级到2.2.X以后对应的cloud版本虽然是H版本,但是gateway版本的netty却对应不上了。所以需要单独引入netty版本
解决
错误2 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.reactorNettyWebSocketClient(GatewayAutoConfiguration.java:738)
The following method did not exist:
org.springframework.web.reactive.socket.client.ReactorNettyWebSocketClient.setHandlePing(Z)V
The method's class, org.springframework.web.reactive.socket.client.ReactorNettyWebSocketClient, is available from the following locations:
jar:file:/E:/java/MAVEN/MavenRepo/org/springframework/spring-webflux/5.2.1.RELEASE/spring-webflux-5.2.1.RELEASE.jar!/org/springframework/web/reactive/socket/client/ReactorNettyWebSocketClient.class
It was loaded from the following location:
file:/E:/java/MAVEN/MavenRepo/org/springframework/spring-webflux/5.2.1.RELEASE/spring-webflux-5.2.1.RELEASE.jar
这个错误原因也是一样,都是版本匹配问题,内部的自动配置类找不到对应的版本依赖,需要单独引入spring-webflux的版本,注意要引入高版本进行向下兼容,否则5.2.1依旧会产生错误
解决 排除掉gateway网关内的webflux,引入一个新的webflux 因为spring cloud gateway是基于webflux的,如果非要web支持的话需要导入spring-boot-starter-webflux而不是spring-boot-start-web。
到此,相信大家对“如何解决升级boot后gateway网关出现的大量问题”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。