SpringBoot 整合 Dubbo 控制台报 [DUBBO] Duplicate class org/apache/dubbo/common/Version.class in 2 jar

2020-11-12 11:47:19 浏览数 (1)

ERROR 10316 --- [ main] org.apache.dubbo.common.Version : [DUBBO] Duplicate class org/apache/dubbo/common/Version.class in 2 jar [file:/D:/mavenRepository/org/apache/dubbo/dubbo/2.7.8/dubbo-2.7.8.jar!/org/apache/dubbo/common/Version.class, file:/D:/mavenRepository/org/apache/dubbo/dubbo-common/2.7.8/dubbo-common-2.7.8.jar!/org/apache/dubbo/common/Version.class], dubbo version: 2.7.8, current host: 10.79.95.223

这明显就是因为 jar 包中有重复依赖

打开 pom.xml 文件, 切换到 Dependency Hierarchy 标签页, 然后可以Filter检索

排除掉相应 jar 包的依赖包就行了

代码语言:javascript复制
<dependency>
	<groupId>org.apache.dubbo</groupId>
	<artifactId>dubbo-serialization-fst</artifactId>
	<exclusions>
		<exclusion>
			<groupId>org.apache.dubbo</groupId>
			<artifactId>dubbo-common</artifactId>
		</exclusion>
	</exclusions>
</dependency>

0 人点赞