Redis Session Serializer mismatch between 3.2 and 4.2

╄→尐↘猪︶ㄣ 提交于 2019-12-30 05:15:05

问题


I have a Spring Cloud-based application running on multiple spring-boot servers. All servers share the same Spring Session using @EnableRedisHttpSession.

I now want to integrate a third party widget into my application. Working with the third party, I was able to get initial configuration running, but I'm failing when the third party tries to access the Redis Session data. This is because I am using Spring 4 and the third party uses Spring 3.2. I cannot upgrade the third party's Spring version.

The exception is:

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:     org.springframework.security.core.context.SecurityContextImpl; local class     incompatible: stream classdesc serialVersionUID = 400, local class     serialVersionUID = 320
Caused by: java.io.InvalidClassException: 
org.springframework.security.core.context.SecurityContextImpl; local class incompatible: stream classdesc serialVersionUID = 400, local class serialVersionUID = 320
at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:616) ~[na:1.8.0_66]
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1623) ~[na:1.8.0_66]
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1518) ~[na:1.8.0_66]    
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1774) ~[na:1.8.0_66]
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351) ~[na:1.8.0_66]
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371) ~[na:1.8.0_66]
at org.springframework.core.serializer.DefaultDeserializer.deserialize(DefaultDeserializer.java:41) ~[spring-core-4.0.6.RELEASE.jar:4.0.6.RELEASE]
at org.springframework.core.serializer.support.DeserializingConverter.convert(DeserializingConverter.java:59) ~[spring-core-4.0.6.RELEASE.jar:4.0.6.RELEASE]
... 66 common frames omitted

Is there any way to easily translate between the two versions?

来源:https://stackoverflow.com/questions/35535765/redis-session-serializer-mismatch-between-3-2-and-4-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!