当前位置:网站首页>记一次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
边栏推荐
- 半监督学习
- Famous blackmail software stops operation and releases decryption keys. Most hospital IOT devices have security vulnerabilities | global network security hotspot on February 14
- 近视:摘镜or配镜?这些问题必须先了解清楚
- 【Proteus仿真】8×8LED点阵屏仿电梯数字滚动显示
- Use percent sign in CString
- Unityshader - materialcapture material capture effect (Emerald axe)
- 《微服务设计》读书笔记(上)
- Driver and application communication
- Microservice API gateway
- Shell script import and export data
猜你喜欢

“用Android复刻Apple产品UI”(3)—优雅的数据统计图表

Nifi from introduction to practice (nanny level tutorial) - flow

Three dimensional reconstruction of deep learning

Create gradle project

Intelij idea efficient skills (III)
![App mobile terminal test [3] ADB command](/img/f1/4bff6e66b77d0f867bf7237019e982.png)
App mobile terminal test [3] ADB command

Redis installation under windows and Linux systems

Project -- high concurrency memory pool

子类隐藏父类的同名函数

《微服务设计》读书笔记(下)
随机推荐
SDNU_ ACM_ ICPC_ 2022_ Winter_ Practice_ 4th [individual]
突破100万,剑指200万!
Reading notes of "micro service design" (Part 2)
Vs2017 is driven by IP debugging (dual machine debugging)
The accept attribute of the El upload upload component restricts the file type (detailed explanation of the case)
《微服务设计》读书笔记(下)
Rk3399 platform development series explanation (WiFi) 5.54. What is WiFi wireless LAN
阿飞的期望
Intelij idea efficient skills (III)
Subclass hides the function with the same name of the parent class
Please be prepared to lose your job at any time within 3 years?
The difference between mutually exclusive objects and critical areas
用通达信炒股开户安全吗?
近视:摘镜or配镜?这些问题必须先了解清楚
Mongodb installation and basic operation
VC下Unicode和ANSI互转,CStringW和std::string互转
子类隐藏父类的同名函数
Get the executable path through the process PID (queryfullprocessimagename)
Effect of ARP package on FTP dump under vxworks-6.6 system
win32创建窗口及按钮(轻量级)