一、该问题的重现步骤是什么?
在bladeX项目里面调用方法SysCache.getTenant("4413");可以正常把tenant对象存到redis里面,也可以正常反序列化取出值,存到redis里面的数据格式如下图所示:
在BladeX-Biz项目的pom.xml文件里面引用blade-system-api依赖来调用SysCache.getTenant("4413");发现获取不到redis里面对应的值,会 自动远程调用blade-system方法来获取成功之后存到redis里面,把bladeX项目里面存的值给覆盖掉,变成这样就可以正常从缓存里获取到值,
但是在bladeX项目里面调用SysCache.getTenant("4413");就会出现反序列异常:
org.springframework.data.redis.serializer.SerializationException: Cannot deserialize; nested exception is org.springframework.core.serializer.support.SerializationFailedException: Failed to deserialize payload. Is the byte array a result of corresponding serialization for DefaultDeserializer?; nested exception is java.io.StreamCorruptedException: invalid stream header: 0BFA0724
at org.springframework.data.redis.serializer.JdkSerializationRedisSerializer.deserialize(JdkSerializationRedisSerializer.java:84)
at org.springframework.data.redis.serializer.DefaultRedisElementReader.read(DefaultRedisElementReader.java:48)
at org.springframework.data.redis.serializer.RedisSerializationContext$SerializationPair.read(RedisSerializationContext.java:226)
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.springblade.core.cache.utils.CacheUtil.get(CacheUtil.java:188)
at org.springblade.core.cache.utils.CacheUtil.get(CacheUtil.java:168)
at org.springblade.system.cache.SysCache.getTenant(SysCache.java:324)
at org.springblade.article.wrapper.ArticleWrapper.entityVO(ArticleWrapper.java:63)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
at org.springblade.article.wrapper.ArticleWrapper.articleListVO(ArticleWrapper.java:57)
at org.springblade.article.wrapper.ArticleWrapper.articlePageVO(ArticleWrapper.java
二、你期待的结果是什么?实际看到的又是什么?
期望通过SysCache.getTenant("4413");缓存到redis里面的值可以正常在bladeX和Bladex-Biz项目正常获取到
三、你正在使用的是什么产品,什么版本?在什么操作系统上?
2.6.0.RELEASE,在windows上面,redis版本redis:5.0.2-alpine扫一扫访问 Blade技术社区 移动端