当前位置:网站首页>记一次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
边栏推荐
- Pychart error updating package list: connect timed out
- 互斥对象与临界区的区别
- Go语言自学系列 | golang中的if else if语句
- 找映射关系
- Problems of CString in multithreading
- Nifi from introduction to practice (nanny level tutorial) - flow
- 突破100万,剑指200万!
- 使用AUR下载并安装常用程序
- pyinstaller不是内部或外部命令,也不是可运行的程序 或批处理文件
- Get the executable path through the process PID (queryfullprocessimagename)
猜你喜欢

深度学习之三维重建

Detailed explanation of string function and string function with unlimited length

Seckill system 2 redis solves the problem of distributed session

From the 18th line to the first line, the new story of the network security industry

How idea starts run dashboard

Microservice - declarative interface call openfeign

Rk3399 platform development series explanation (WiFi) 5.54. What is WiFi wireless LAN

子类隐藏父类的同名函数

《微服务设计》读书笔记(下)

How can technology managers quickly improve leadership?
随机推荐
Location of software installation information and system services in the registry
无心剑中译泰戈尔《漂鸟集(1~10)》
pyinstaller不是内部或外部命令,也不是可运行的程序 或批处理文件
【Proteus仿真】8×8LED点阵屏仿电梯数字滚动显示
Effect of ARP package on FTP dump under vxworks-6.6 system
"Remake Apple product UI with Android" (3) - elegant statistical chart
Pychart error updating package list: connect timed out
Persisting in output requires continuous learning
Microservice sentinel flow control degradation
Principles of several common IO models
Low level version of drawing interface (explain each step in detail)
Why can't strings be directly compared with equals; Why can't some integers be directly compared with the equal sign
Go语言自学系列 | golang switch语句
从 flask 服务端代码自动生成客户端代码 -- flask-native-stubs 库介绍
Salary 3000, monthly income 40000 by "video editing": people who can make money never rely on hard work!
Project -- high concurrency memory pool
A Fei's expectation
Mongodb installation and basic operation
“用Android复刻Apple产品UI”(3)—优雅的数据统计图表
找映射关系