Jedis: java.lang.NumberFormatException: For input string: “6379@13028“

报错内容

Caused by: java.lang.NumberFormatException: For input string: "6379@13028"
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:39)
at redis.clients.util.ClusterNodeInformationParser.parse(ClusterNodeInformationParser.java:14)
at redis.clients.jedis.JedisClusterInfoCache.discoverClusterNodesAndSlots(JedisClusterInfoCache.java:50)
at redis.clients.jedis.JedisClusterConnectionHandler.initializeSlotsCache(JedisClusterConnectionHandler.java:39)
...

可能原因

Jedis 2.8版本及以下引入了ClusterNodeInformationParser来解析cluster slots返回值,但是Redis后续更改了此命令返回值类型,所以解析报错NumberFormatException

建议方法

升级 Jedis 版本到2.9.0

GitHub相关

https://github.com/redis/jedis/issues/1958

https://issues.apache.org/jira/browse/BAHIR-306

你可能感兴趣的:(Redis客户端报错速查,java,开发语言,redis)