Redis获取数据报错Could not read JSON: Unrecognized token 'XXXXX': was expecting ('true', 'false' or 'null'

日前由于公司Redis集群切换,导致一些初始化数据需要重新设置到新的Redis;

使用Redis可视化 RedisDesktopManager进行设置

Redis获取数据报错Could not read JSON: Unrecognized token 'XXXXX': was expecting ('true', 'false' or 'null'_第1张图片

设置成功,到获取的时候发生异常:

2020-04-02 15:42:05.118 yxcode-merak [http-nio-8080-exec-14] ERROR c.y.y.m.c.handle.ExceptionHandle [ExceptionHandle.java : 223] [17be3573a9be7b9f] - 【系统异常】
Could not read JSON: Unrecognized token 'TM2003250094': was expecting ('true', 'false' or 'null')
 at [Source: [B@62e2fc74; line: 1, column: 25]; nested exception is com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'TM2003250094': was expectin
g ('true', 'false' or 'null')
 at [Source: [B@62e2fc74; line: 1, column: 25]
org.springframework.data.redis.serializer.SerializationException: Could not read JSON: Unrecognized token 'TM2003250094': was expecting ('true', 'false' or 'null'
)
 at [Source: [B@62e2fc74; line: 1, column: 25]; nested exception is com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'TM2003250094': was expectin
g ('true', 'false' or 'null')
 at [Source: [B@62e2fc74; line: 1, column: 25]
        at org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer.deserialize(Jackson2JsonRedisSerializer.java:73)
        at org.springframework.data.redis.core.AbstractOperations.deserializeValue(AbstractOperations.java:318)
        at org.springframework.data.redis.core.AbstractOperations$ValueDeserializingRedisCallback.doInRedis(AbstractOperations.java:58)
        at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:207)
        at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:169)
        at org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:91)
        at org.springframework.data.redis.core.DefaultValueOperations.get(DefaultValueOperations.java:43)

 

经最后发现由于项目Redis配置有关,配置如下:

Redis获取数据报错Could not read JSON: Unrecognized token 'XXXXX': was expecting ('true', 'false' or 'null'_第2张图片

发现value使用了json序列化,导致上面直接设置的value字符串序列化时报解析json异常;

解决方法:1、将Redis配置修改掉  2、设置值的时候将值加上引号,如Redis获取数据报错Could not read JSON: Unrecognized token 'XXXXX': was expecting ('true', 'false' or 'null'_第3张图片

你可能感兴趣的:(Redis获取数据报错Could not read JSON: Unrecognized token 'XXXXX': was expecting ('true', 'false' or 'null')