当前位置:网站首页>记一次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
边栏推荐
- Remote file contains actual operation
- Embedded development: seven reasons to avoid open source software
- App移动端测试【5】文件的写入、读取
- Microservice - declarative interface call openfeign
- How can technology managers quickly improve leadership?
- Persisting in output requires continuous learning
- About text selection in web pages and counting the length of selected text
- Low level version of drawing interface (explain each step in detail)
- Three dimensional reconstruction of deep learning
- Unityshader - materialcapture material capture effect (Emerald axe)
猜你喜欢
[proteus simulation] 74hc595+74ls154 drive display 16x16 dot matrix
Creation and destruction of function stack frames
Detailed explanation of string function and string function with unlimited length
Break through 1million, sword finger 2million!
【OpenCV 例程200篇】217. 鼠标交互获取多边形区域(ROI)
Microservice - fuse hystrix
Remote file contains actual operation
Seckill system 3- product list and product details
[list to map] collectors Tomap syntax sharing (case practice)
Redis installation under windows and Linux systems
随机推荐
Using optimistic lock and pessimistic lock in MySQL to realize distributed lock
通过进程PID获取可执行文件路径(QueryFullProcessImageName)
请做好3年内随时失业的准备?
Go language self-study series | if else statement in golang
"Remake Apple product UI with Android" (2) -- silky Appstore card transition animation
Remote file contains actual operation
Reading notes of "micro service design" (Part 2)
Mongodb installation and basic operation
Function introduction of JMeter thread group
潘多拉 IOT 开发板学习(HAL 库)—— 实验5 外部中断实验(学习笔记)
CString getbuffer and releasebuffer instructions
[系统安全] 四十三.Powershell恶意代码检测系列 (5)抽象语法树自动提取万字详解
从 flask 服务端代码自动生成客户端代码 -- flask-native-stubs 库介绍
用同花顺炒股开户安全吗?
First!! Is lancet hungry? Official documents
The difference between RAR and zip files
请求头不同国家和语言的表示
Uploads labs range (with source code analysis) (under update)
Popular understanding of random forest
App移动端测试【3】ADB命令