前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >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 ...

作者头像
时间静止不是简史
发布2021-03-15 11:05:57
19.6K0
发布2021-03-15 11:05:57
举报
文章被收录于专栏:Java探索之路Java探索之路

项目场景:

在拉取别人新建的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的版本即可

在这里插入图片描述
在这里插入图片描述
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2021-03-11 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 项目场景:
  • 问题描述:
  • 原因分析:
  • 解决方案:
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档