maven项目中使用redis集群报错: java.lang.NumberFormatException: For input string: "7006@17006"

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [redis.clients.jedis.JedisCluster]: Constructor threw exception; nested exception is java.lang.NumberFormatException: For input string: "7006@17006"

at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163)

at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:122)

at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:267)

... 65 more

Caused by: java.lang.NumberFormatException: For input string: "7006@17006"

at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)

 

 

解决:由于 redis 集群的采用的版本是 4.1 的,在 maven 的 pom.xml 中将 jedis 的版本改成 2.9 的就可以了,

    <dependency>
            <groupId>redis.clients</groupId>
            <artifactId>jedis</artifactId>
            <version>2.9.0</version>
    </dependency>