尝试在Spring Boot 2.1.6.RELEASE
中使用带有Redis的会话。我遇到了SerializationException
的例外。控制台表示无法使用org.springframework.session.web.http.SessionRepositoryFilter$SessionRepositoryRequestWrapper$HttpSessionWrapper
序列化DefaultSerializer
的对象。
错误消息:
org.springframework.data.redis.serializer.SerializationException:无法序列化;嵌套的异常是org.springframework.core.serializer.support.SerializationFailedException:无法使用DefaultSerializer序列化对象。嵌套的异常是java.io.NotSerializableException:org.springframework.session.web.http.SessionRepositoryFilter $ SessionRepositoryRequestWrapper $ HttpSessionWrapper 在org.springframework.data.redis.serializer.JdkSerializationRedisSerializer.serialize(JdkSerializationRedisSerializer.java:96)〜[spring-data-redis-2.1.9.RELEASE.jar:2.1.9.RELEASE] 在org.springframework.data.redis.core.AbstractOperations.rawHashValue(AbstractOperations.java:184)〜[spring-data-redis-2.1.9.RELEASE.jar:2.1.9.RELEASE] ... 原因:org.springframework.core.serializer.support.SerializationFailedException:无法使用DefaultSerializer序列化对象;嵌套的异常是java.io.NotSerializableException:org.springframework.session.web.http.SessionRepositoryFilter $ SessionRepositoryRequestWrapper $ HttpSessionWrapper 在org.springframework.core.serializer.support.SerializingConverter.convert(SerializingConverter.java:68)〜[spring-core-5.1.8.RELEASE.jar:5.1.8.RELEASE] 在org.springframework.core.serializer.support.SerializingConverter.convert(SerializingConverter.java:35)〜[spring-core-5.1.8.RELEASE.jar:5.1.8.RELEASE] 在org.springframework.data.redis.serializer.JdkSerializationRedisSerializer.serialize(JdkSerializationRedisSerializer.java:94)〜[spring-data-redis-2.1.9.RELEASE.jar:2.1.9.RELEASE] ... 引起原因:java.io.NotSerializableException:org.springframework.session.web.http.SessionRepositoryFilter $ SessionRepositoryRequestWrapper $ HttpSessionWrapper 在java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)〜[na:1.8.0_163] 在java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)〜[na:1.8.0_163] 在java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)〜[na:1.8.0_163]