反序列化失败:

java.lang.IllegalStateException: Failed to execute CommandLineRunner
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:779)
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:760)
at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:747)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151)
at com.lk.acApplication.main(acApplication.java:27)
Caused by: 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.InvalidClassException: com.lk.base.ac.model.Tenant; local class incompatible: stream classdesc serialVersionUID = -6743567631108323096, local class serialVersionUID = -3998150864330771094
at org.springframework.data.redis.serializer.JdkSerializationRedisSerializer.deserialize(JdkSerializationRedisSerializer.java:82)
at org.springframework.data.redis.cache.RedisCache$CacheValueAccessor.deserializeIfNecessary(RedisCache.java:477)
at org.springframework.data.redis.cache.RedisCache.lookup(RedisCache.java:323)
at org.springframework.data.redis.cache.RedisCache.get(RedisCache.java:184)
at org.springframework.data.redis.cache.RedisCache.get(RedisCache.java:133)
at org.springframework.cache.interceptor.AbstractCacheInvoker.doGet(AbstractCacheInvoker.java:71)
at org.springframework.cache.interceptor.CacheAspectSupport.findInCaches(CacheAspectSupport.java:537)
at org.springframework.cache.interceptor.CacheAspectSupport.findCachedItem(CacheAspectSupport.java:503)
at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:389)
at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:327)
at org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:61)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:656)
at com.lk.base.ac.dao.TenantDao$$EnhancerBySpringCGLIB$$c5ba8fe5.selectAll(<generated>)
at com.lk.CacheCommandLineRunner.run(CacheCommandLineRunner.java:35)
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:776)
... 6 common frames omitted
Caused by: 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.InvalidClassException: com.lk.base.ac.model.Tenant; local class incompatible: stream classdesc serialVersionUID = -6743567631108323096, local class serialVersionUID = -3998150864330771094
at org.springframework.core.serializer.support.DeserializingConverter.convert(DeserializingConverter.java:78)
at org.springframework.core.serializer.support.DeserializingConverter.convert(DeserializingConverter.java:36)
at org.springframework.data.redis.serializer.JdkSerializationRedisSerializer.deserialize(JdkSerializationRedisSerializer.java:80)
... 21 common frames omitted
Caused by: java.io.InvalidClassException: com.lk.base.ac.model.Tenant; local class incompatible: stream classdesc serialVersionUID = -6743567631108323096, local class serialVersionUID = -3998150864330771094
at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:616)

仔细一想, 是我之前把Tenant 信息放到了redis 中, 然后,  重启了服务, 然后再次获取的时候, 就出现了这样的情况.

可以看到根本原因在于: 
local class incompatible: stream classdesc serialVersionUID = -6743567631108323096, local class serialVersionUID = -3998150864330771094

只需要在Tenant class 中增加下面的即可:

private static final long serialVersionUID = -6743567631108323096L;

反序列化失败Failed to deserialize --- local class incompatible: stream classdesc serialVersionUID的更多相关文章

  1. local class incompatible: stream classdesc serialVersionUID = -2897844985684768944, local class serialVersionUID = 7350468743759137184

    local class incompatible: stream classdesc serialVersionUID = 1, local class serialVersionUID = 2427 ...

  2. local class incompatible: stream classdesc serialVersionUID = 4125096758372084309, local class serialVersionUID = 7725746634795906143

    local class incompatible: stream classdesc serialVersionUID = 4125096758372084309, local class seria ...

  3. weblogic:local class incompatible: stream classdesc serialVersionUID

    问题:jdk版本不兼容 方法:修改weblogic对应的jdk版本

  4. stream classdesc serialVersionUID = -7218828885279815404, local class serialVersionUID = 1.

    序列化类时出现的异常! 当某一个类实现java.io.Serializable接口时,该类默认会生成一个private static final long serialVersionUID = 1L; ...

  5. Java 异常 —— java.io.InvalidClassException: javax.xml.namespace.QName; local class incompatible

    项目中有个 WebService 接口,调试时使用 Main 方法运行,别人的机器上都能运行,就笔者的机器出问题.他们说是RP的问题…… 异常信息: java.io.InvalidClassExcep ...

  6. java.io.InvalidClassException: com.master.CurrentMessages; local class incompatible:

    报错信息如下: java.io.InvalidClassException: com.master.CurrentMessages; local class incompatible: stream ...

  7. 对象序列化与反序列化local class incompatible

    无论eclipse还是idea(默认关闭序列化提示,需手动打开),都可以自动生成相应的序列号,分为两类1L,XXXL. 当然如果不指定,系统也会自动生成,但是存在隐性风险 ,不同的编译器对同一个对象可 ...

  8. RedisTemplate SerializationFailedException: Failed to deserialize payload 异常解决

    问题描述: 使用RedisTemplate(spring-data-redis )进行redis操作的封装 , 现有一个incr的key , 当调用incr后返回值一切正常, 当对此key进行get调 ...

  9. RedisTemplate: Failed to deserialize payload

    问题 org.springframework.data.redis.serializer.SerializationException: Cannot deserialize; nested exce ...

随机推荐

  1. ajax中的一些参数的含义及用法

    jquery中的ajax方法参数总结: 1.url:  要求为String类型的参数,(默认为当前页地址)发送请求的地址. 2.type:  要求为String类型的参数,请求方式(post或get) ...

  2. 第一个Spring 程序

    一 搭建好开发环境 JDK Eclipse 等 二 下载jar包 https://commons.apache.org/logging/ https://repo.spring.io/release/ ...

  3. 2017年3月30日15:00:19 fq以后的以后 动态代理

    代理与继承,组合不同的是,继承是继承父类特性,组合是拼装组合类的特性,代理是使用代理类的指定方法并可以做自定义. 静态类是应用单个类,当代理的类数量较多时可用动态代理,动态代理在概念上很好理解 htt ...

  4. 关于Idea启动配置tomcat

    1.打开file中setting中搜索Application Servers,如下图 2.添加服务器类型,例如tomcat,如下图,添加完成之后可以选定tomcat的目录,tomcat Home配置t ...

  5. 实验楼 MySQL 基础课程 挑战:搭建一个简易的成绩管理系统的数据库

    传送门:https://www.shiyanlou.com/courses/running 介绍 现需要构建一个简易的成绩管理系统的数据库,来记录几门课程的学生成绩.数据库中有三张表分别用于记录学生信 ...

  6. 两个1/x类的广义函数

    [转载请注明出处]http://www.cnblogs.com/mashiqi 2017/04/15 1.$\text{p.v.}\,\frac{1}{x}$ 因为$(x \ln x - x)' = ...

  7. msm8909平台JEITA配置和bat-V therm表合入

    8909平台的冷热充电温度点是硬件控制的,不能软件控制,目前硬件设置的是0~55度的充电区间. 软件上应该设置的是BTM comparator threshold, 70%(cold)~35%(hot ...

  8. 关于JVM的一些冷知识

    (1) Java加载类的一般顺序: 1.静态属性,静态方法声明,静态块. 2.动态属性,普通方法声明,构造块. 3.构造方法. 当加载一个类时,JVM会根据属性的数据类型第一时间赋默认值(一举生成的) ...

  9. python函数之第一类对象

    目录 python函数之第一类对象 python函数之第一类对象 第一类对象(英语:First-class object)在计算机科学中指可以在执行期创造并作为参数传递给其他函数或存入一个变数的实体. ...

  10. python中str函数isdigit、isdecimal、isnumeric的区别

    num = "1" #unicodenum.isdigit() # Truenum.isdecimal() # Truenum.isnumeric() # True num = & ...