|
在做springboot 2.x + redis(采用jedis)整合,启动时
JedisConnectionFactory factory = new JedisConnectionFactory();
抛出异常:Factory method 'jedisConnectionFactory' threw exception; nested exception is java.lang.NoClassDefFoundError: redis/clients/util/Pool
其中:
spring-boot-starter-data-redis 版本号为2.1.9;引入的spring-data-redis版本号为2.1.11
<!-- 1.5的版本默认采用的连接池技术是jedis 2.0以上版本默认连接池是lettuce, 在这里采用jedis,所以需要排除lettuce的jar -->

问题原因:应该是依赖包里面spring-data-redis与引入的jedis版本有冲突


改动前:
<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!
注意:貌似jedis 3.0.0版本以上均不可。所以需要注意版本!!!!
|