org.springframework.data.redis.serializer.SerializationException: Cannot serialize;
错误:
. ____ _ __ _ _/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \\\/ ___)| |_)| | | | | || (_| | ) ) ) )' |____| .__|_| |_|_| |_\__, | / / / /=========|_|==============|___/=/_/_/_/:: Spring Boot :: (v2.4.4)org.springframework.data.redis.serializer.SerializationException: Cannot serialize; nested exception is org.springframework.core.serializer.support.SerializationFailedException: Failed to serialize object using DefaultSerializer; nested exception is java.lang.IllegalArgumentException: DefaultSerializer requires a Serializable payload but received an object of type [com.peng.pojo.User]at org.springframework.data.redis.serializer.JdkSerializationRedisSerializer.serialize(JdkSerializationRedisSerializer.java:96)at ............
Caused by: org.springframework.core.serializer.support.SerializationFailedException: Failed to serialize object using DefaultSerializer; nested exception is java.lang.IllegalArgumentException: DefaultSerializer requires a Serializable payload but received an object of type [com.peng.pojo.User]at org.springframework.core.serializer.support.SerializingConverter.convert(SerializingConverter.java:64)at org.springframework.core.serializer.support.SerializingConverter.convert(SerializingConverter.java:33)at org.springframework.data.redis.serializer.JdkSerializationRedisSerializer.serialize(JdkSerializationRedisSerializer.java:94)... 68 more
Caused by: java.lang.IllegalArgumentException: DefaultSerializer requires a Serializable payload but received an object of type [com.peng.pojo.User]at org.springframework.core.serializer.DefaultSerializer.serialize(DefaultSerializer.java:43)at org.springframework.core.serializer.Serializer.serializeToByteArray(Serializer.java:56)at org.springframework.core.serializer.support.SerializingConverter.convert(SerializingConverter.java:60)... 70 more2021-03-30 21:49:41.641 INFO 1396 --- [extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'Process finished with exit code -1
错误原因
:序列化异常SerializationException
从下面这句话可以看出原因是pojo实体类User没有序列化
java.lang.IllegalArgumentException: DefaultSerializer requires a Serializable payload but received an object of type [com.peng.pojo.User]
需要的是一个序列化之后的参数,但是我们提供的参数是一个Object
解决方法
让这个实体类实现Serializable接口即可
org.springframework.data.redis.serializer.SerializationException: Cannot serialize;相关推荐
- org.springframework.data.redis.serializer.SerializationException: Cannot serialize; nested exception
要缓存的JavaBean必须实现Serializable接口,因为Spring会将对象先序列化再存入 Redis,如测试用例中的com.ssm.promotion.core.entity.Articl ...
- org.springframework.data.redis.RedisSystemException: Error in execution; nes遇到springboot连接Redis报错
org.springframework.data.redis.RedisSystemException: Error in execution; nested exception is io.lett ...
- Consider revisiting the entries above or defining a bean of type 'org.springframework.data.redis……'
Consider revisiting the entries above or defining a bean of type 'org.springframework.data.redis.con ...
- Consider revisiting the entries above or defining a bean of type ‘org.springframework.data.redis.con
Redis导包错误 麻麻地搞了小半天 业务逻辑写好了就搁这遇到拦路虎了 只能说自己道行不够 解决: 之前单个单个加就报错 各种报错 一股脑都加上就能跑 太玄学了 <dependency> ...
- org.springframework.data.redis 一次连接获取特定key所有k-v(pipeline)
2019独角兽企业重金招聘Python工程师标准>>> 当我们需要一次性获取在redis中以hash方式存储的所有key-value时,我们可以使用下面的方式来获取. public ...
- kotlin使用spring data redis(二)
2019独角兽企业重金招聘Python工程师标准>>> 自定义序列化器 1.标准json序列化器,时间类型禁用时间戳 import com.fasterxml.jackson.cor ...
- spring mvc Spring Data Redis RedisTemplate [转]
http://maven.springframework.org/release/org/springframework/data/spring-data-redis/(spring-data包下载) ...
- Spring data redis乱码问题
SpringBoot提供Redis存储序列化,常用的有一下几种: JdkSerializationRedisSerializer:将数据序列化为对象 默认的 StringRedisSerializer ...
- 012_Spring Data Redis
1. Spring Data Redis简介 2. Spring Data Redis相关jar包 2.1. Spring相关jar包 2.2. Spring Data Redis相关jar包 2.3 ...
最新文章
- Unix/Linux环境C编程入门教程(39) shell命令之系统管理
- 插入顶部_声屏障顶部斜插式安装可获得10-25dB的降噪量
- 对待棘手bug,新手与大牛的差距在哪里?
- div 超出高度滚动条,超出宽度点点点
- ubuntu20.04自带python版本_替换 ubuntu 自带的python版本
- 推荐Java学习书籍
- 程序员面试金典——17.4无判断max
- 数据库表之间的数据导入 sql语句
- 【Excel】定位条件快速将空值替换为指定值
- 秀米编辑器如何排版svg推文,以展开为模板讲解
- html div里里h标签居中,html之块级标签h系列,div
- npm install报错解决fatal: Unable to look up github.com (port 9418) npm ERR! exited with error code: 128
- 小米校招 C++研发 相机部 一二面
- 计算机二级c语言考上机考试吗,计算机二级c语言上机考试操作步骤及流程
- Codeforces Round#466 E. Cashback
- 胡谨的个人简介及一生
- Python实现倒计时程序
- Python转换图像格式,超全
- vue 获取当前时间(并与演出时间对比做出状态改变)
- 如何录制电脑正在播放的声音及音乐?
热门文章
- CSS深入理解学习笔记之vertical-align
- 【iCore1S 双核心板_ARM】例程三:EXTI中断输入实验——读取ARM按键状态
- Kafka的配置文件详细描述
- 转载:MySQL数据库INSERT、UPDATE、DELETE以及REPLACE语句的用法详解
- 艾伟:WCF从理论到实践(2):决战紫禁之巅
- 知识库如何跟其他业务系统结合
- linux系统常见操作,Linux系统基本操作
- 服务器应用日志清理,Linux下Tomcat日志定期清理
- [转载] python元组 tuple
- 一? ilkkn.n_IL&FS的完整形式是什么?