springboot要整合hbase链接api:phenix,结果运行时报以下错误:
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call the method com.google.common.collect.Multimaps.asMap(Lcom/google/common/collect/ListMultimap;)Ljava/util/Map; but it does not exist. Its class, com.google.common.collect.Multimaps, is available from the following locations:
jar:file:/C:/Users/Person/.m2/repository/com/google/guava/guava/14.0/guava-14.0.jar!/com/google/common/collect/Multimaps.class
It was loaded from the following location:
file:/C:/Users/Person/.m2/repository/com/google/guava/guava/14.0/guava-14.0.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of com.google.common.collect.Multimaps
在网上查了查报错的原因是:
原因是在项目中用到了swagger2,接口测试
他的依赖中:
谷歌的guava包版本为:20
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>20.0</version>
<scope>compile</scope>
</dependency>
而hbase中guava版本为13
<guava.version>13.0.1</guava.version>
现在想到的解决办法是:
maven-shade-plugin
这个办法
关于它:
大家可以通过以下链接了解:
链接一
链接二
但是在翻maven仓库时,
swagger2的2.10.0版本,并不依赖guava了
传送门
而在2.9版本还是依赖的:
传送门2
所以问题解决就简单:升级版本就行了!
我还尝试用maven的exclusion解决,
结果报以下错误:
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call the method com.google.common.collect.Multimaps.asMap(Lcom/google/common/collect/ListMultimap;)Ljava/util/Map; but it does not exist. Its class, com.google.common.collect.Multimaps, is available from the following locations:
jar:file:/C:/Users/Person/.m2/repository/com/google/guava/guava/14.0/guava-14.0.jar!/com/google/common/collect/Multimaps.class
It was loaded from the following location:
file:/C:/Users/Person/.m2/repository/com/google/guava/guava/14.0/guava-14.0.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of com.google.common.collect.Multimaps
据说包重复造成的