本篇内容主要讲解“如何解决升级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版本
解决
错误2Description:
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网关出现的大量问题”有了更深的了解,不妨来实际操作一番吧!这里是创新互联网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!