微服务分布式缓存:无法反序列化 Cannot deserialize;

问题描述

在拆分SpringBoot项目搭建微服务的过程中,需要配置分布式缓存,对redis进行配置,配置完成后,在启动Knife4j文档界面时报错,发现是redis无法反序列化的问题,但是报错中所指出的类com.jhin.jhinoj.model.entity.User已经实现了序列化接口

问题解决

我的微服务对应的redis数据库中本身存在数据,是我在原先的单体服务中进行登录操作所存下的,由于前后包路径不同,这个数据已经无法在新的微服务项目中反序列化成实例,所以每当服务模块连接redis数据库时就会产生无法反序列化的问题

我在指定redis数据库中清除了原先单体项目缓存的数据,至此,错误解除

什么是序列化与反序列化?

参考:什么是序列化-什么是反序列化

核心报错内容

powershell 复制代码
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 org.springframework.core.NestedIOException: Failed to deserialize object type; 
nested exception is java.lang.ClassNotFoundException: com.jhin.jhinoj.model.entity.User
相关推荐
fanly112 天前
Surging AI Agent 完整产品介绍
微服务·microservice
小七-七牛开发者8 天前
TokenPilot:让 LLM Agent 长会话成本降 60%+ 的上下文管理
缓存·agent·token·context·上下文·推理成本
蝎子莱莱爱打怪9 天前
XZLL-IM干货系列 04|Netty 长连接实战:Pipeline 怎么排、心跳怎么跳、连接怎么管
后端·微服务·面试
SamDeepThinking10 天前
Java微服务练习方式
java·后端·微服务
米丘13 天前
微前端之 Web Components 完全指南
微服务·html
霸道流氓气质15 天前
领域驱动设计(DDD)在 Spring Boot 微服务中的实践指南
运维·spring boot·微服务
ofoxcoding15 天前
在AI API聚合平台配置DeepSeek V3.2提示词缓存实战:快速接入与成本优化指南
人工智能·spring·缓存·ai
NeilYuen16 天前
gRPC结合FAISS构建AI助手语义缓存模块(一):设计
人工智能·缓存·faiss
taocarts_bidfans16 天前
反向海淘跨境缓存架构优化:taocarts Redis分层缓存实战技术
redis·缓存·架构·反向海淘·taocarts