jedisConnectionFactory: NoClassDefFoundError: redis/clients/util/Pool

 

When doing springboot 2.x + redis (using jedis) integration, when starting 

JedisConnectionFactory factory = new JedisConnectionFactory();
抛出异常:Factory method 'jedisConnectionFactory' threw exception; nested exception is java.lang.NoClassDefFoundError: redis/clients/util/Pool 

among them:

The version number of spring-boot-starter-data-redis is 2.1.9; the version number of the introduced spring-data-redis is 2.1.11
<!-- The default connection pool technology adopted by the version 1.5 is the default connection pool of versions above jedis 2.0 It is lettuce, jedis is used here, so lettuce jar needs to be excluded -->


The cause of the problem: It should be that spring-data-redis in the dependency package conflicts with the introduced jedis version

Before the change:

<dependency>
   <groupId>redis.clients</groupId>
   <artifactId>jedis</artifactId>
   <version>3.1.0</version>
</dependency>
改动后:

<dependency>
   <groupId>redis.clients</groupId>
   <artifactId>jedis</artifactId>
   <version>2.9.1</version>
</dependency>
启动OK!

Note: It seems that jedis version 3.0.0 and above are not available. So pay attention to the version! ! ! !
————————————————
Copyright statement: This article is the original article of the CSDN blogger "catch-exception", and it follows the CC 4.0 BY-SA copyright agreement. Please attach the original source link and This statement.
Original link: https://blog.csdn.net/doubleqinyan/article/details/102688467

Guess you like

Origin blog.csdn.net/superiorpengFight/article/details/106654451