SpringBoot报错: Correct the classpath of your application so that it contains a single ...

项目场景:

在拉取别人新建的Springboot项目, 出现关于Correct the classpath of your application so that it contains a single, compatible version of xxx错误

错误关键描述如下:

Correct the classpath of your application so that it contains a single, compatible version of org.apache.commons.pool2.impl.GenericObjectPoolConfig

问题描述:

下面是错误的详细描述

2021-03-11 10:00:22.145 ERROR 10196 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    io.lettuce.core.support.CommonsPool2ConfigConverter.bounded(CommonsPool2ConfigConverter.java:49)

The following method did not exist:

    org.apache.commons.pool2.impl.GenericObjectPoolConfig.getTestOnCreate()Z

The method's class, org.apache.commons.pool2.impl.GenericObjectPoolConfig, is available from the following locations:

    jar:file:/C:/Users/Administrator/.m2/repository/org/apache/commons/commons-pool2/2.0/commons-pool2-2.0.jar!/org/apache/commons/pool2/impl/GenericObjectPoolConfig.class

The class hierarchy was loaded from the following locations:

    org.apache.commons.pool2.impl.GenericObjectPoolConfig: file:/C:/Users/Administrator/.m2/repository/org/apache/commons/commons-pool2/2.0/commons-pool2-2.0.jar
    org.apache.commons.pool2.impl.BaseObjectPoolConfig: file:/C:/Users/Administrator/.m2/repository/org/apache/commons/commons-pool2/2.0/commons-pool2-2.0.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of org.apache.commons.pool2.impl.GenericObjectPoolConfig


Process finished with exit code 1


原因分析:

原因是jar版本冲突 ,如springboot starter parent与下面引用的某些启动器或者其他jar版本不一致,导致缓存了多个jar, 而启动时不知道选取哪个版本的jar导致错误

解决方案:

从下图可以看到启动器父版本和子启动器版本不一样,
去除commons-pool2的版本即可
在这里插入图片描述

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

时间静止不是简史

感谢你的肯定, 我将继续努力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值