反序列化失败Failed to deserialize --- local class incompatible: stream classdesc serialVersionUID
反序列化失败:
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的更多相关文章
- local class incompatible: stream classdesc serialVersionUID = -2897844985684768944, local class serialVersionUID = 7350468743759137184
local class incompatible: stream classdesc serialVersionUID = 1, local class serialVersionUID = 2427 ...
- local class incompatible: stream classdesc serialVersionUID = 4125096758372084309, local class serialVersionUID = 7725746634795906143
local class incompatible: stream classdesc serialVersionUID = 4125096758372084309, local class seria ...
- weblogic:local class incompatible: stream classdesc serialVersionUID
问题:jdk版本不兼容 方法:修改weblogic对应的jdk版本
- stream classdesc serialVersionUID = -7218828885279815404, local class serialVersionUID = 1.
序列化类时出现的异常! 当某一个类实现java.io.Serializable接口时,该类默认会生成一个private static final long serialVersionUID = 1L; ...
- Java 异常 —— java.io.InvalidClassException: javax.xml.namespace.QName; local class incompatible
项目中有个 WebService 接口,调试时使用 Main 方法运行,别人的机器上都能运行,就笔者的机器出问题.他们说是RP的问题…… 异常信息: java.io.InvalidClassExcep ...
- java.io.InvalidClassException: com.master.CurrentMessages; local class incompatible:
报错信息如下: java.io.InvalidClassException: com.master.CurrentMessages; local class incompatible: stream ...
- 对象序列化与反序列化local class incompatible
无论eclipse还是idea(默认关闭序列化提示,需手动打开),都可以自动生成相应的序列号,分为两类1L,XXXL. 当然如果不指定,系统也会自动生成,但是存在隐性风险 ,不同的编译器对同一个对象可 ...
- RedisTemplate SerializationFailedException: Failed to deserialize payload 异常解决
问题描述: 使用RedisTemplate(spring-data-redis )进行redis操作的封装 , 现有一个incr的key , 当调用incr后返回值一切正常, 当对此key进行get调 ...
- RedisTemplate: Failed to deserialize payload
问题 org.springframework.data.redis.serializer.SerializationException: Cannot deserialize; nested exce ...
随机推荐
- find -exec 批量使用方法
查找当前目录批量文件内容后复制到指定目录当中 find . -type f -name "*.log" -exec cp {} /目标目录/ \;
- 浮动滚动条 slimScroll
1.引入jquery 2.映入slimScrolljs :<script src="https://cdn.bootcss.com/jQuery-slimScroll/1.3.8/jq ...
- 2018-北航-面向对象-前三次OO作业分析与小结
基于度量的程序结构分析 由于平时使用了NetBrains出品的IDEA作为IDE,在分析程序的时候我使用了IDEA的插件Metrics Reloaded.然而在使用时发现不懂得很多分析项目的含义,因此 ...
- leetcode题解2. Add Two Numbers
题目: You are given two non-empty linked lists representing two non-negative integers. The digits are ...
- lettuce行为驱动框架实例
练习: 一:e1_MyFirstBDD 使用方法的方式实现阶乘的计算 zero.feature: Feature: Compute factorial In order to play with Le ...
- 《JavaScript 设计模式与开发实战》第一部分(1、2、3章)笔记
第1章:面向对象的JavaScript 动态类型和鸭子类型 编程语言按照数据类型大体可以分为两类: ① 静态类型语言:在编译时便已确定变量的类型. ② 动态类型语言:变量类型要到程序运行的时候,待变量 ...
- java.math.*;(一)
package com.test; /* Math类: java.lang.Math类中包含基本的数字操作,如指数.对数.平方根和三角函数. java.math是一个包,提供用于执行任意精度整数(Bi ...
- 使用try和catch捕获异常
Java程序在执行过程中如果出现异常,会自动生成一个异常对象,该异常对象将被自动提交给JVM,当JVM接收到异常对象时,会寻找能处理这一异常的代码,并把当前异常对象交给其处理,这一过程称为捕获(cat ...
- Okhttp、Volley和Gson的简单介绍和配合使用
转载自:http://www.apkbus.com/home.php?mod=space&uid=784586&do=blog&id=61255 1.okhttp是一个高效的. ...
- Tomcat配置虚拟主机、tomcat的日志
1.配置Tomcat的虚拟主机修改:vim /usr/local/tomcat9/conf/server.xml 添加一个虚拟主机:加入: <Host name="www.tomcat ...