当前位置:网站首页>记一次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
边栏推荐
- Go语言自学系列 | golang switch语句
- 坚持输出需要不断学习
- Wechat payment -jsapi: code implementation (payment asynchronous callback, Chinese parameter solution)
- Win32 create window and button (lightweight)
- The accept attribute of the El upload upload component restricts the file type (detailed explanation of the case)
- Secsha system 1- login function
- Redis high availability and persistence
- A Fei's expectation
- [combinatorial mathematics] binomial theorem and combinatorial identity (binomial theorem | three combinatorial identities | recursive formula 1 | recursive formula 2 | recursive formula 3 Pascal / Ya
- [系统安全] 四十三.Powershell恶意代码检测系列 (5)抽象语法树自动提取万字详解
猜你喜欢

Wechat payment -jsapi: code implementation (payment asynchronous callback, Chinese parameter solution)

突破100万,剑指200万!

Microservices - load balancing ribbon

Remote file contains actual operation

QT use qzxing to generate QR code

MB10M-ASEMI整流桥MB10M
![[list to map] collectors Tomap syntax sharing (case practice)](/img/ac/e02deb1cb237806d357a88fb812852.jpg)
[list to map] collectors Tomap syntax sharing (case practice)

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

Automatic generation of client code from flask server code -- Introduction to flask native stubs Library

初试scikit-learn库
随机推荐
坚持输出需要不断学习
Microservice - fuse hystrix
App mobile terminal test [3] ADB command
[系统安全] 四十三.Powershell恶意代码检测系列 (5)抽象语法树自动提取万字详解
Microservice API gateway zuul
[system safety] 43 PowerShell malicious code detection series (5) automatic extraction of ten thousand words from abstract syntax tree
Unityshader - materialcapture material capture effect (Emerald axe)
Calibre LVL
大csv拆分和合并
[list to map] collectors Tomap syntax sharing (case practice)
Redis high availability and persistence
Microservice - declarative interface call openfeign
App移动端测试【5】文件的写入、读取
“用Android复刻Apple产品UI”(2)——丝滑的AppStore卡片转场动画
Project -- high concurrency memory pool
Problems of CString in multithreading
C language brush questions ~leetcode and simple questions of niuke.com
Subclass hides the function with the same name of the parent class
Unity function - unity offline document download and use
The wonderful use of do{}while()