java.lang.IollegalArgumentException:找不到名为RequestRateLimit的Ga



我使用spring网关作为所有服务网关,今天我面临一个问题:

2022-08-05 11:25:14.594 ERROR 1 --- [oundedElastic-5] r.c.p.Operators                          : Operator called default onErrorDropped
reactor.core.Exceptions$ErrorCallbackNotImplemented: java.lang.IllegalArgumentException: Unable to find GatewayFilterFactory with name RequestRateLimiter
Caused by: java.lang.IllegalArgumentException: Unable to find GatewayFilterFactory with name RequestRateLimiter
at org.springframework.cloud.gateway.route.RouteDefinitionRouteLocator.loadGatewayFilters(RouteDefinitionRouteLocator.java:130) ~[spring-cloud-gateway-server-3.1.2.jar!/:3.1.2]
at org.springframework.cloud.gateway.route.RouteDefinitionRouteLocator.getFilters(RouteDefinitionRouteLocator.java:176) ~[spring-cloud-gateway-server-3.1.2.jar!/:3.1.2]
at org.springframework.cloud.gateway.route.RouteDefinitionRouteLocator.convertToRoute(RouteDefinitionRouteLocator.java:117) ~[spring-cloud-gateway-server-3.1.2.jar!/:3.1.2]
at org.springframework.cloud.gateway.route.RouteDefinitionRouteLocator$$Lambda$1131/0x00000000e8016030.apply(Unknown Source) ~[?:?]
at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:106) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.FluxFlatMap$FlatMapMain.tryEmitScalar(FluxFlatMap.java:488) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.FluxFlatMap$FlatMapMain.onNext(FluxFlatMap.java:421) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.FluxMergeSequential$MergeSequentialMain.drain(FluxMergeSequential.java:432) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.FluxMergeSequential$MergeSequentialMain.innerComplete(FluxMergeSequential.java:328) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.FluxMergeSequential$MergeSequentialInner.onComplete(FluxMergeSequential.java:584) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:142) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.MonoFlatMapMany$FlatMapManyInner.onComplete(MonoFlatMapMany.java:260) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.FluxIterable$IterableSubscription.slowPath(FluxIterable.java:294) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.FluxIterable$IterableSubscription.request(FluxIterable.java:230) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.MonoFlatMapMany$FlatMapManyMain.onSubscribeInner(MonoFlatMapMany.java:150) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.MonoFlatMapMany$FlatMapManyInner.onSubscribe(MonoFlatMapMany.java:245) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:165) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:87) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.Flux.subscribe(Flux.java:8469) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.MonoFlatMapMany$FlatMapManyMain.onNext(MonoFlatMapMany.java:195) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1816) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.MonoCollect$CollectSubscriber.onComplete(MonoCollect.java:159) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.FluxFilter$FilterSubscriber.onComplete(FluxFilter.java:166) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.FluxFlatMap$FlatMapMain.checkTerminated(FluxFlatMap.java:846) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.FluxFlatMap$FlatMapMain.drainLoop(FluxFlatMap.java:608) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.FluxFlatMap$FlatMapMain.drain(FluxFlatMap.java:588) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.FluxFlatMap$FlatMapMain.onComplete(FluxFlatMap.java:465) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.FluxFilter$FilterSubscriber.onComplete(FluxFilter.java:166) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.FluxFlatMap$FlatMapMain.checkTerminated(FluxFlatMap.java:846) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.FluxFlatMap$FlatMapMain.drainLoop(FluxFlatMap.java:608) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.FluxFlatMap$FlatMapMain.innerComplete(FluxFlatMap.java:894) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.FluxFlatMap$FlatMapInner.onComplete(FluxFlatMap.java:997) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1799) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.MonoCollectList$MonoCollectListSubscriber.onComplete(MonoCollectList.java:128) [reactor-core-3.4.17.jar!/:3.4.17]
at org.springframework.cloud.commons.publisher.FluxFirstNonEmptyEmitting$FirstNonEmptyEmittingSubscriber.onComplete(FluxFirstNonEmptyEmitting.java:325) [spring-cloud-commons-3.1.2.jar!/:3.1.2]
at reactor.core.publisher.FluxSubscribeOn$SubscribeOnSubscriber.onComplete(FluxSubscribeOn.java:166) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.onComplete(Operators.java:2058) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.FluxIterable$IterableSubscription.fastPath(FluxIterable.java:362) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.FluxIterable$IterableSubscription.request(FluxIterable.java:227) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.set(Operators.java:2194) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onSubscribe(FluxOnErrorResume.java:74) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:165) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:87) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.FluxDefer.subscribe(FluxDefer.java:54) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.InternalFluxOperator.subscribe(InternalFluxOperator.java:62) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.publisher.FluxSubscribeOn$SubscribeOnSubscriber.run(FluxSubscribeOn.java:194) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.scheduler.WorkerTask.call(WorkerTask.java:84) [reactor-core-3.4.17.jar!/:3.4.17]
at reactor.core.scheduler.WorkerTask.call(WorkerTask.java:37) [reactor-core-3.4.17.jar!/:3.4.17]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
at java.lang.Thread.run(Thread.java:836) [?:?]

我已经尝试添加这样的反应性redis依赖项:

implementation group: 'org.springframework.boot', name: 'spring-boot-starter-data-redis-reactive', version: '2.7.2'

这是yam-config:项目

gateway:
discovery:
locator:
enabled: true
lower-case-service-id: true
httpclient:
pool:
maxIdleTime: 10000
wiretap: true
httpserver:
wiretap: true
routes:
- filters:
- name: JwtAuthentication
- name: RequestRateLimiter
args:
redis-rate-limiter.replenishRate: 10
redis-rate-limiter.burstCapacity: 20
redis-rate-limiter.requestedTokens: 1
key-resolver: "#{@pathKeyResolver}"  
id: time-capsule-service
order: 2
predicates:
- Path=/tik/**
uri: http://10.111.149.10:11015
- filters:
- name: JwtAuthentication

我是不是错过了什么?我该怎么办才能解决这个问题?RequestRateLimiter是一个我不需要自己实现的系统嵌入式过滤器吗?我只在一些url模式中添加了速率限制器,我应该为所有模式添加吗?

我终于发现jedis现在不支持reactive,spring网关应该使用生菜。我已经把生菜排除在整个项目之外了。因此删除排除代码:

configurations.all {
// exclude group: "io.lettuce", module: "lettuce-core"
}

并为spring网关添加了反应性redis依赖项,如下所示:

implementation group: 'org.springframework.boot', name: 'spring-boot-starter-data-redis-reactive', version: '2.7.2'

相关内容

  • 没有找到相关文章

最新更新