Redis集群环境使用的是redis4.0.x的版本,在用java客户端jedisCluster启动集群做数据处理时报java.lang.NumberFormatException: For input string: "7003@17003"问题解决

时间:2022-01-12 01:42:59
java.lang.NumberFormatException: For input string: "7003@17003"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:580)
at java.lang.Integer.valueOf(Integer.java:766)
at redis.clients.util.ClusterNodeInformationParser.getHostAndPortFromNodeLine(ClusterNodeInformationParser.java:38)
at redis.clients.util.ClusterNodeInformationParser.parse(ClusterNodeInformationParser.java:14)
at redis.clients.jedis.JedisClusterInfoCache.discoverClusterNodesAndSlots(JedisClusterInfoCache.java:43)
at redis.clients.jedis.JedisClusterConnectionHandler.initializeSlotsCache(JedisClusterConnectionHandler.java:52)
at redis.clients.jedis.JedisClusterConnectionHandler.<init>(JedisClusterConnectionHandler.java:37)
at redis.clients.jedis.JedisSlotBasedConnectionHandler.<init>(JedisSlotBasedConnectionHandler.java:16)
at redis.clients.jedis.JedisCluster.<init>(JedisCluster.java:48)
at redis.clients.jedis.JedisCluster.<init>(JedisCluster.java:35)
at redis.clients.jedis.JedisCluster.<init>(JedisCluster.java:27)
....后面就不写了
解决方案:(仅供参考,大家不喜勿喷)
		/**
* 报错如下:
* java.lang.NumberFormatException: For input string: "7006@17006"
* 集群环境Redis使用的是4.0.1的版本
* 报错之前使用的jedis版本为2.7.x
* 之后版本替换为2.9.0完美解决问题
* <dependency>
*    <groupId>redis.clients</groupId>
*     <artifactId>jedis</artifactId>
*    <version>2.9.0</version>
*    <type>jar</type>
*    <scope>compile</scope>
* </dependency>

*/