当前位置:网站首页>记一次jar包冲突解决过程
记一次jar包冲突解决过程
2022-07-03 16:00:00 【龙池小生】
问题描述:
在做一个功能,需要用到 org.apache.curator 下的 curator-framework jar包,程序运行过程中报错,对比其他项目、查阅资料发现是 curator-framework包版本太高,没有找到对应的方法,排除高版本的包后,启动项目报错,根据启动日志发现是 com.google.guva.guava的jar包冲突,重新引入guava包问题解决。
1、程序运行报错,jar包冲突
报错信息:
java.lang.NoSuchMethodError: org.apache.curator.framework.api.CreateBuilder.creatingParentContainersIfNeeded()Lorg/apache/curator/framework/api/ProtectACLCreateModePathAndBytesable;
问题排查与解决:
查找方法:org.apache.curator.framework.api.CreateBuilder.creatingParentContainersIfNeeded
没有找到方法 creatingParentContainersIfNeeded,然后发现curator包下有两个版本,4.0.1 和2.9.1,然后对比了下之前项目使用到curator的版本是2.9.1,确定是包版本冲突了,应该引入curator-framework 2.9.1的版本包。
查找 curator-framework 引用树,idea 的terminal执行命令
mvn dependency:tree -Dverbose -Dincludes=org.apache.curator:curator-framework
maven依赖树:
找到引用了4.0.1版本的pom并排除:
排除后:
2、项目启动报错,jar包冲突:
上面的问题解决后,启动项目报错:
报错信息描述大意是没有找到jar包的sameThreadExecutor方法 ,又是jar冲突了,23.0版本的guava包没有此方法。
An attempt was made to call the method com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor()Lcom/google/common/util/concurrent/ListeningExecutorService; but it does not exist. Its class, com.google.common.util.concurrent.MoreExecutors, is available from the following locations:
jar:file:/C:/Users/Administrator/.m2/repository/com/google/guava/guava/23.0/guava-23.0.jar!/com/google/common/util/concurrent/MoreExecutors.class
It was loaded from the following location:
file:/C:/Users/Administrator/.m2/repository/com/google/guava/guava/23.0/guava-23.0.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of com.google.common.util.concurrent.MoreExecutors
对比其他项目,guava包引入的是20.0版本的。
在pom中重新引入pom依赖,覆盖23.0版本的包,项目成功启动:
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>20.0</version>
</dependency>
maven 查看依赖命令:
查看指定jar包的依赖树:
mvn dependency:tree -Dverbose -Dincludes=org.apache.curator:curator-framework
查看项目所有jar包的依赖树:
mvn dependency:tree
查看项目所有jar包的依赖树,并输出到指定文件:
mvn dependency:tree>D:\maven.txt
边栏推荐
- First!! Is lancet hungry? Official documents
- UnityShader——MaterialCapture材质捕捉效果 (翡翠斧头)
- App移动端测试【3】ADB命令
- Location of software installation information and system services in the registry
- How idea starts run dashboard
- Download and install common programs using AUR
- MB10M-ASEMI整流桥MB10M
- Intelij idea efficient skills (III)
- Why can't strings be directly compared with equals; Why can't some integers be directly compared with the equal sign
- WinDbg分析dump文件
猜你喜欢
Brush questions -- sword finger offer
String functions that you need to know
"Remake Apple product UI with Android" (2) -- silky Appstore card transition animation
Creation and destruction of function stack frames
Microservice API gateway zuul
App mobile terminal test [3] ADB command
Microservice sentinel flow control degradation
Redis在Windows以及Linux系统下的安装
从 flask 服务端代码自动生成客户端代码 -- flask-native-stubs 库介绍
[list to map] collectors Tomap syntax sharing (case practice)
随机推荐
远程文件包含实操
Automatic generation of client code from flask server code -- Introduction to flask native stubs Library
Go language self-study series | golang switch statement
从 flask 服务端代码自动生成客户端代码 -- flask-native-stubs 库介绍
Unity function - unity offline document download and use
The difference between mutually exclusive objects and critical areas
Function introduction of JMeter thread group
Unityshader - materialcapture material capture effect (Emerald axe)
Seckill system 3- product list and product details
阿飞的期望
Backtracking method to solve batch job scheduling problem
驱动与应用程序通信
Srs4.0+obs studio+vlc3 (environment construction and basic use demonstration)
Detailed pointer advanced 1
App移动端测试【4】apk的操纵
String functions that you need to know
Please be prepared to lose your job at any time within 3 years?
Create gradle project
Detailed explanation of four modes of distributed transaction (Seata)
VS2017通过IP调试驱动(双机调试)