300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > 项目引入 swagger 启动报错处理(An attempt was made to call the method com.google.common.collect.FluentIterable)

项目引入 swagger 启动报错处理(An attempt was made to call the method com.google.common.collect.FluentIterable)

时间:2022-01-12 16:21:52

相关推荐

项目引入 swagger 启动报错处理(An attempt was made to call the method com.google.common.collect.FluentIterable)

背景介绍

我用的springboot框架,是用maven构建的项目,加入swagger依赖的时候启动的时候报错

报错信息:

***************************APPLICATION FAILED TO START***************************Description:An attempt was made to call the method mon.collect.FluentIterable.concat(Ljava/lang/Iterable;Ljava/lang/Iterable;)Lcom/google/common/collect/FluentIterable; but it does not exist. Its class, mon.collect.FluentIterable, is available from the following locations:jar:file:/repository/com/google/guava/guava/19.0/guava-19.0.jar!/com/google/common/collect/FluentIterable.classIt was loaded from the following location:file:/repository/com/google/guava/guava/19.0/guava-19.0.jarAction:Correct the classpath of your application so that it contains a single, compatible version of mon.collect.FluentIterableProcess finished with exit code 0

定位原因:

根据错误定位是jar包冲突,

1、执行maven命令查看项目jar包依赖关系

mvn dependency:tree >tree.log

2、依赖引用分析发现有多个地方引用了guava

--nacos-client

--swagger

解决方案:

在启动项目模块中pom.xml 指定guava版本,重新启动项目。

<dependency><groupId>com.google.guava</groupId><artifactId>guava</artifactId><version>29.0-jre</version></dependency>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。