- 错误解决办法
- 报错信息如下
redis.serializer.SerializationException: Could not read JSON: Unexpected character) 错误解决办法
@Cacheable注解来自如下两个包:
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.RedisTemplate;
当在需要对外输出的接口中使用了该redis缓存注解时,redis数据要先序列化,再通过网络传输出去,由于出现了缓存序列化错误,导致该缓存无法正常序列化传输出去。
解决办法就是不要用这个@Cacheable注解,使用其他方式使用redis缓存。
报错信息如下org.springframework.data.redis.serializer.SerializationException: Could not read JSON: Unexpected character ('¬' (code 172)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
at [Source: (byte[])"�� sr java.util.ArrayListx����a� I sizexp w sr 6com.xhwl.common.pojo.cent.device.DeviceProductCategory L codet Ljava/lang/String;L createdAtt Ljava/util/Date;L idt Ljava/lang/Integer;L nameq ~ L updatedAtq ~ xr 5com.baomidou.mybatisplus.extension.activerecord.Model xppsr java.util.Datehj�KYt xp xF� xsr java.lang.Integer⠤���8 I valuexr java.lang.Number������ xp t 系统sq ~ xF� xsq ~ psq ~ xF� xsq ~
t "[truncated 297 bytes]; line: 1, column: 2]; nested exception is com.fasterxml.jackson.core.JsonParseException: Unexpected character ('¬' (code 172)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
at [Source: (byte[])"�� sr java.util.ArrayListx����a� I sizexp w sr 6com.xhwl.common.pojo.cent.device.DeviceProductCategory L codet Ljava/lang/String;L createdAtt Ljava/util/Date;L idt Ljava/lang/Integer;L nameq ~ L updatedAtq ~ xr 5com.baomidou.mybatisplus.extension.activerecord.Model xppsr java.util.Datehj�KYt xp xF� xsr java.lang.Integer⠤���8 I valuexr java.lang.Number������ xp t 系统sq ~ xF� xsq ~ psq ~ xF� xsq ~
t "[truncated 297 bytes]; line: 1, column: 2]
at org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer.deserialize(Jackson2JsonRedisSerializer.java:75)
at org.springframework.data.redis.serializer.DefaultRedisElementReader.read(DefaultRedisElementReader.java:48)
at org.springframework.data.redis.serializer.RedisSerializationContext$SerializationPair.read(RedisSerializationContext.java:272)
at org.springframework.data.redis.cache.RedisCache.deserializeCachevalue(RedisCache.java:260)
at org.springframework.data.redis.cache.RedisCache.lookup(RedisCache.java:94)
at org.springframework.cache.support.AbstractValueAdaptingCache.get(AbstractValueAdaptingCache.java:58)
at org.springframework.cache.interceptor.AbstractCacheInvoker.doGet(AbstractCacheInvoker.java:73)
at org.springframework.cache.interceptor.CacheAspectSupport.findInCaches(CacheAspectSupport.java:554)
at org.springframework.cache.interceptor.CacheAspectSupport.findCachedItem(CacheAspectSupport.java:519)
at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:401)
at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:345)
at org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:61)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.ja
加载更多



