记录Guava版本冲突而出现项目启动失败的问题

系列文章目录

该博文主要用于记录由于Guava版本冲突而导致项目启动失败的问题,排查该问题,前后花了一个小时,特此记录,方便后续排坑。

一、问题现状

最近为了方便调用公司某一个请求时,搭建一套Feign + Hystrix环境。环境搭建完成后,启动直接报错。报错信息如下

Description:
An attempt was made to call the method com.google.common.collect.FluentIterable.append(Ljava/lang/Iterable;)Lcom/google/common/collect/FluentIterable; but it does not exist. Its class, com.google.common.collect.FluentIterable, is available from the following locations:

    jar:file:/I:/java/maven%20repository/com/google/guava/guava/15.0/guava-15.0.jar!/com/google/common/collect/FluentIterable.class

It was loaded from the following location:
    file:/I:/java/maven%20repository/com/google/guava/guava/15.0/guava-15.0.jar
Action:

Correct the classpath of your application so that it contains a single, compatible version of com.google.common.collect.FluentIterable

然后开启了漫长排坑之路。

二、问题原因

经过漫长分析、定位,发现netfix-hystrix使用低版本的Guava依赖,而之前为了测试方便,引入了Swagger-ui依赖,碰巧,swagger-ui使用了一个高版本guava。从而在启动的时候,出现了guava版本冲突问题。
在这里插入图片描述

解决措施

问题原因找到了之后,其实解决方式特别简单,移除低版本的guava依赖即可。

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
    <version>1.4.5.RELEASE</version>
    <exclusions>
        <exclusion>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </exclusion>
    </exclusions>
</dependency>
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

我要做个有钱人2020

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值