Factory method ‘ribbonLoadBalancer‘ threw exception; nested exception is java.lang.IllegalArgumentEx

Factory method ‘ribbonLoadBalancer‘ threw exception; nested exception is java.lang.IllegalArgumentEx,第1张

Factory method ‘ribbonLoadBalancer‘ threw exception; nested exception is java.lang.IllegalArgumentEx 项目版本

springBootVersion = “2.6.1”
springCloudVersion = “2021.0.0”


问题描述:

消费者模块通过openfeign调用提供者,消费者模块启动报错
异常日志:
Factory method ‘ribbonLoadBalancer’ threw exception; nested exception is java.lang.IllegalArgumentException: value cannot be empty


解决方案:
//SpringCloud Feign在Hoxton.M2 RELEASED版本之后不再使用Ribbon而是使用spring-cloud-loadbalancer
implementation "org.springframework.cloud:spring-cloud-starter-loadbalancer"
//导入 spring-cloud-loadbalancer后nacos中 spring-cloud-starter-netflix-ribbon会与它冲突,造成loadbalanc包失效;或者添加配置yml关闭ribbon
implementation('com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-discovery'){
	exclude group: 'org.springframework.cloud', module: 'spring-cloud-starter-netflix-ribbon'
}

不使用ribbon(默认启动)

spring:
  cloud:
    nacos:
      loadbalancer:
        ribbon:
          enabled: false

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5678451.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存