微服务openfeign问题,本地运行调用正常。部署到linux上openfeign调用就报错,不知道啥原因。求帮忙,头皮发麻
把你的jar包给解压下,看看里面有没/有多个 "spring-cloud-openfeign-core-xxxx.jar"
感觉是打包的问题
jar -xvf xxxx.jar
你头皮发麻,其实我手写你的报错都瑟瑟发抖,你也可看看吧,毕竟我对这块可能还没你熟。我只在协同你分析解决你的问题:
'net.lbol.pangu.auth.api.client.AuthLoginApi':Unexpected exception during bean creation; nesred exception is org.springframework.beans.factory.BeanCreationException:Failed to parse configuration class
[org.springframework.cloud.openfeign.FeignClientsConfiguration]; nested
exception is java lang llledgalArgumentException: Could not find class
[org.springframework.cloud.openfeign.FeignClientsMetricsEnabledCondition]
org.springframework.beans.factory.BeanCreationException:创建名为“net.lbol.pangu.auth.api.client.AuthLoginPi”的bean时出错:创建bean时出现意外异常;
这是第一个问题:1、注入 bean 失败异常
分析:
对应的 bean 没有添加注解;
对应的 bean 添加注解错误
选择错误的自动注入方法
nesred异常是org.springframework.beans.factory。
BeanCreationException:无法分析配置类
这是第二个问题:BeanCreationException:无法分析配置类
分析:
与同名和类的现有的、不兼容的bean定义冲突
[org.springframework.cloud.openfeign.FeignClientsConfiguration];嵌套的,嵌套的
异常是java lang llledgalArgumentException:找不到类
这是第三个问题:异常是java lang llledgalArgumentException:找不到类
分析:
使用的Springboot 和 SpringCloud版本出现问题
【目前能帮助到你的就这么多,如在解决问题中有遇到问题,随时联系,辛苦】
FeignClientMetricsEnabledCondition类从spring-cloud-openfeign-core的3.0.2版本
开始提供,看看你的pom文件中是否存在多个spring-cloud-openfeign-core版本。
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-openfeign-core</artifactId>
<version>3.0.2</version>
</dependency>
SpringCloud Feign在Hoxton.M2 RELEASED版本之后不再使用ribbon而是使用spring-cloud-loadbalancer,所以在不引入spring-cloud-loadbalancer情况下会报错。还是看看配置和版本
这个提示是关键
Failed to parse configuration class
1、看看网络问题;
2、看看配置问题
3、看看配置服务器问题
4、看看防火墙问题
5、看看权限问题
6、看看jdk环境问题