反序列化失败:

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. Java包装类的自动拆装箱

    题目: Integer i = 42; Long l = 42l; Double d = 42.0; 下面为true的是 A.(i == l) B.(i == d) C.(l == d) D.i.eq ...

  2. OpenStack的HA方案

    一.HA服务分类 HA将服务分为两类: 有状态服务:后续对服务的请求依赖之前对服务的请求,OpenStack中有状态的服务包括MySQL数据库和AMQP消息队列.对于有状态类服务的HA,如neutro ...

  3. 《JavaScript Dom 编程艺术》读书笔记-第8章

    充实文档的内容,包括几个方面: 一个为文档创建“缩略图列表”的函数: 一个为文档创建“文献来源链接”的函数: 一个为文档创建“快捷键清单”的函数. <abbr>在HTML5 中以取代< ...

  4. JavaScript之Math

    1. Math Math是js的内置函数,无需创建,把Math作为对象使用就可以调用其属性和方法. 2.Date    2.1 日期对象创建 var now = new Date ( ); 含参数时表 ...

  5. linux之目录文件操作

  6. 实验 2:备份和还原IOS

    SW1配置 Switch>en Switch#conf t Enter configuration commands, one per line. End with CNTL/Z. Switch ...

  7. 有人WIFI ble101配置

    新买来的模块,默认为slave模式,波特率57600,8位数据位,无检验位,1位停止位. 发送+++a,进入命令模式. 需要加回车符 1.设置模块名称 AT+NAME=BT_Shining 2.设置发 ...

  8. 安装jdk1.8

    这是很普通的shell的脚本,只需要注意:echo 语句内出现的变量,需要转义! #!/bin/bash function get_current_time_stamp(){ echo `date & ...

  9. 【python接口自动化框架-unittest】如何传参数到下一个case

    1.前提 平时我们用unittest的时候,都知道每个test_ 都是相互独立的,但是很多现实情况是,我们下一个接口参数,可能会用到上一个接口返回的json字段,那么,我们怎么去实现呢 2.实例 1. ...

  10. uml类图符号

    符号及实例参照:http://www.blogjava.net/cnfree/archive/2012/10/30/390457.html https://blog.csdn.net/l_nan/ar ...