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:/C:/Users/XXX/.m2/repository/com/google/guava/guava/16.0.1/guava-16.0.1.jar!/com/google/common/collect/FluentIterable.class
It was loaded from the following location:
file:/C:/Users/XXX/.m2/repository/com/google/guava/guava/16.0.1/guava-16.0.1.jar
Action:
背景:
在rabbon工程中加入swagger引发的错误。
环境:
spring-cloud-starter-netflix-ribbon Greenwich.RC2
swagger-spring-boot-starter 1.8.0.RELEASE
排查:
打开pom.xml文件,切换到dependency hierarchy
左侧为各jar包之间的关系视图,右侧为决定jar包版本的视图
在右侧找出报错的jar包名称,单击,左侧用到的会自动高亮,
然后我这边是因为swagger的guava.jar用到了20,决定性版本为16.0.1,不兼容所以出错了
如下图
解决方案1:统一版本
就是为jar包指定一个版本,所有用到的都会是这个版本
按图操作。。
然后ok,在pom.xml中就会对jar包指定版本,
应该可以改成其他版本吧?
搞定~
解决方案2:排除加载
就是在别的用到这个jar包的地方加上说明,告诉它不用自己加载依赖用别人的。
按图操作。。
这里可以看到它默认每个都排除加载了,那就是所以都不加载,那就是没有加载肯定报错,所以要去掉一个不用排除
搞定~
所以还是方案一方便...
转载:雨后浅浅唱 非常感谢作者,解决了问题