jedis,spring-redis-data 整合使用,版本問題異常
阿新 • • 發佈:2017-11-16
問題 artifact ons com pri connect def 中心 div
jedis,spring-redis-data 整合使用,版本不匹配的時候經常會報一些異常,例如
1: java.lang.NoClassDefFoundError: org/springframework/data/geo/Metric
2:java.lang.NoSuchMethodError: redis.clients.jedis.JedisCluster.set([B[B)Ljava/lang/String
3:jedis.exceptions.JedisConnectionException: Unknown reply: 3
都是jedis,spring-redis-data,spring-data-common等包版本匹配引起的。
最佳解決辦法,以spring-redis-data包為中心,引用與之相匹配的jedis或spring-data-common:
<dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-commons</artifactId> <version>1.8.4.RELEASE</version> </dependency> <!--spring-data-redisr--><dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-redis</artifactId> <version>1.8.4.RELEASE</version> </dependency> <dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId> <version>2.9.0</version> </dependency>
jedis,spring-redis-data 整合使用,版本問題異常