When integrating redis with springboot, an error is reported when introducing the jar package:
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
Solution:
Delete the version number in the dependency, and springboot will automatically match the appropriate version
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
</dependency>
Similar Posts:
- [Solved] Spring Boot Use Spring Data Redis Error: org.springframework.beans.factory.BeanCreationException
- [Solved] Jedis:Exception in thread “main” java.lang.VerifyError: Bad type on operand stack
- [Solved] SpringBoot Access Redis Error: java.lang.NoSuchMethodError: redis.clients.jedis.JedisPoolConfig.setMinEvictableIdleTime
- Redis uses connection pool to solve the problem of error reporting
- [Solved] Jsonobject has no from object, idea has no Maven dependency, jsonobject Maven dependency package
- java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory
- [Solved] Spring Boot Error: Failed to instantiate SLF4J LoggerFactory Reported exception:
- Mysql Cannot get a connection, pool error Timeout waiting for idle object
- How to Solve Cannot determine embedded database driver class for database type NONE
- Springboot Import Error: Cannot resolve org.springframework.boot:spring-boot-autoconfigure:2.6.2