报错:An attempt was made to call a method that does not exist. The attempt was made from the following location:
springboot整合redis时引入jar包报错:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-12-13 15:56:24.872 ERROR 24864 --- [ 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:
org.springframework.boot.autoconfigure.data.redis.LettuceConnectionConfiguration$PoolBuilderFactory.getPoolConfig(LettuceConnectionConfiguration.java:188)
The following method did not exist:
org.apache.commons.pool2.impl.GenericObjectPoolConfig.setMaxWait(Ljava/time/Duration;)V
The calling method's class, org.springframework.boot.autoconfigure.data.redis.LettuceConnectionConfiguration$PoolBuilderFactory, was loaded from the following location:
jar:file:/D:/develop_toops/maven/maven_repository/org/springframework/boot/spring-boot-autoconfigure/2.6.1/spring-boot-autoconfigure-2.6.1.jar!/org/springframework/boot/autoconfigure/data/redis/LettuceConnectionConfiguration$PoolBuilderFactory.class
The called method's class, org.apache.commons.pool2.impl.GenericObjectPoolConfig, is available from the following locations:
jar:file:/D:/develop_toops/maven/maven_repository/org/apache/commons/commons-pool2/2.6.0/commons-pool2-2.6.0.jar!/org/apache/commons/pool2/impl/GenericObjectPoolConfig.class
The called method's class hierarchy was loaded from the following locations:
org.apache.commons.pool2.impl.GenericObjectPoolConfig: file:/D:/develop_toops/maven/maven_repository/org/apache/commons/commons-pool2/2.6.0/commons-pool2-2.6.0.jar
org.apache.commons.pool2.impl.BaseObjectPoolConfig: file:/D:/develop_toops/maven/maven_repository/org/apache/commons/commons-pool2/2.6.0/commons-pool2-2.6.0.jar
org.apache.commons.pool2.BaseObject: file:/D:/develop_toops/maven/maven_repository/org/apache/commons/commons-pool2/2.6.0/commons-pool2-2.6.0.jar
Action:
Correct the classpath of your application so that it contains compatible versions of the classes org.springframework.boot.autoconfigure.data.redis.LettuceConnectionConfiguration$PoolBuilderFactory and org.apache.commons.pool2.impl.GenericObjectPoolConfig
解决办法:
将依赖中版本号删除,springboot会自动匹配合适的版本
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
</dependency>
本文作者:贾博文
本文链接:https://www.cnblogs.com/jiabowenn/p/15683814.html
版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步