Cannot deserialize; nested exception is org.springframework.core.serializer.support.SerializationFailedException: Failed to deserialize payload

hamid

I am using eclipse marse jee, spring 4, redis 3.

I downloaded a spring example from here. This example has 4 applications:

admin - gateway - resource - ui.

I have ran all of these program. I tested http://localhost:8080/ui/ and log in with username:admin, password:admin. I got this error in ui application.

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 = 410, local class serialVersionUID = 400
    at org.springframework.data.redis.serializer.JdkSerializationRedisSerializer.deserialize(JdkSerializationRedisSerializer.java:41) ~[spring-data-redis-1.6.4.RELEASE.jar:na]
    at org.springframework.data.redis.core.AbstractOperations.deserializeHashValue(AbstractOperations.java:316) ~[spring-data-redis-1.6.4.RELEASE.jar:na]
    at org.springframework.data.redis.core.AbstractOperations.deserializeHashMap(AbstractOperations.java:277) ~[spring-data-redis-1.6.4.RELEASE.jar:na]
    at org.springframework.data.redis.core.DefaultHashOperations.entries(DefaultHashOperations.java:227) ~[spring-data-redis-1.6.4.RELEASE.jar:na]
    at org.springframework.data.redis.core.DefaultBoundHashOperations.entries(DefaultBoundHashOperations.java:101) ~[spring-data-redis-1.6.4.RELEASE.jar:na]
    at org.springframework.session.data.redis.RedisOperationsSessionRepository.getSession(RedisOperationsSessionRepository.java:233) ~[spring-session-1.0.2.RELEASE.jar:na]
    at org.springframework.session.data.redis.RedisOperationsSessionRepository.getSession(RedisOperationsSessionRepository.java:220) ~[spring-session-1.0.2.RELEASE.jar:na]
    at org.springframework.session.data.redis.RedisOperationsSessionRepository.getSession(RedisOperationsSessionRepository.java:141) ~[spring-session-1.0.2.RELEASE.jar:na]
    at org.springframework.session.web.http.SessionRepositoryFilter$SessionRepositoryRequestWrapper.getSession(SessionRepositoryFilter.java:276) ~[spring-session-1.0.2.RELEASE.jar:na]
    at org.springframework.web.context.request.ServletRequestAttributes.updateAccessedSessionAttributes(ServletRequestAttributes.java:255) ~[spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE]
    at org.springframework.web.context.request.AbstractRequestAttributes.requestCompleted(AbstractRequestAttributes.java:48) ~[spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE]
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:106) ~[spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) ~[tomcat-embed-core-8.0.33.jar:8.0.33]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) ~[tomcat-embed-core-8.0.33.jar:8.0.33]
    at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:87) ~[spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) ~[tomcat-embed-core-8.0.33.jar:8.0.33]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) ~[tomcat-embed-core-8.0.33.jar:8.0.33]
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) ~[spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) ~[tomcat-embed-core-8.0.33.jar:8.0.33]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) ~[tomcat-embed-core-8.0.33.jar:8.0.33]
    at org.springframework.session.web.http.SessionRepositoryFilter.doFilterInternal(SessionRepositoryFilter.java:125) ~[spring-session-1.0.2.RELEASE.jar:na]
    at org.springframework.session.web.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:65) ~[spring-session-1.0.2.RELEASE.jar:na]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) ~[tomcat-embed-core-8.0.33.jar:8.0.33]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) ~[tomcat-embed-core-8.0.33.jar:8.0.33]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121) ~[spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) ~[tomcat-embed-core-8.0.33.jar:8.0.33]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) ~[tomcat-embed-core-8.0.33.jar:8.0.33]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) ~[tomcat-embed-core-8.0.33.jar:8.0.33]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) [tomcat-embed-core-8.0.33.jar:8.0.33]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) [tomcat-embed-core-8.0.33.jar:8.0.33]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) [tomcat-embed-core-8.0.33.jar:8.0.33]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [tomcat-embed-core-8.0.33.jar:8.0.33]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) [tomcat-embed-core-8.0.33.jar:8.0.33]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522) [tomcat-embed-core-8.0.33.jar:8.0.33]
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095) [tomcat-embed-core-8.0.33.jar:8.0.33]
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672) [tomcat-embed-core-8.0.33.jar:8.0.33]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1502) [tomcat-embed-core-8.0.33.jar:8.0.33]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1458) [tomcat-embed-core-8.0.33.jar:8.0.33]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_05]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_05]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.0.33.jar:8.0.33]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_05]
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: org.springframework.security.core.context.SecurityContextImpl; local class incompatible: stream classdesc serialVersionUID = 410, local class serialVersionUID = 400
    at org.springframework.core.serializer.support.DeserializingConverter.convert(DeserializingConverter.java:78) ~[spring-core-4.2.6.RELEASE.jar:4.2.6.RELEASE]
    at org.springframework.core.serializer.support.DeserializingConverter.convert(DeserializingConverter.java:36) ~[spring-core-4.2.6.RELEASE.jar:4.2.6.RELEASE]
    at org.springframework.data.redis.serializer.JdkSerializationRedisSerializer.deserialize(JdkSerializationRedisSerializer.java:39) ~[spring-data-redis-1.6.4.RELEASE.jar:na]
... 45 common frames omitted
Caused by: java.io.InvalidClassException: org.springframework.security.core.context.SecurityContextImpl; local class incompatible: stream classdesc serialVersionUID = 410, local class serialVersionUID = 400
    at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:621) ~[na:1.8.0_05]
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1623) ~[na:1.8.0_05]
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1518) ~[na:1.8.0_05]
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1774) ~[na:1.8.0_05]
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351) ~[na:1.8.0_05]
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371) ~[na:1.8.0_05]
    at org.springframework.core.serializer.DefaultDeserializer.deserialize(DefaultDeserializer.java:70) ~[spring-core-4.2.6.RELEASE.jar:4.2.6.RELEASE]
    at org.springframework.core.serializer.support.DeserializingConverter.convert(DeserializingConverter.java:73) ~[spring-core-4.2.6.RELEASE.jar:4.2.6.RELEASE]
    ... 47 common frames omitted

Can anyone help me?

borowis

Seems like SpringSecurityContextImpl can't be deserialized correctly. 410 and 400 means Spring 4.0 and Spring 4.1. There's a similar question for mismatch between Spring 3.2 and Spring 4.2 Redis Session Serializer mismatch between 3.2 and 4.2. That's a bit tricky, because I can see you're just trying to run an example, I think the most straightforward way to fix this is to not store session data in Redis (e.g. remove @EnableRedisHttpSession). Perhaps, also verify that the Spring 4.1 is used everywhere, and Spring 4 is not pulled in by some transitive dependency.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Caused by: org.springframework.data.redis.serializer.SerializationException: Cannot deserialize; nested exception is org.springframework.core.seriali

From Dev

HTTP Status 500 - Request processing failed; nested exception is org.springframework.web.bind.annotation.support.HandlerMethodInvocationException

From Dev

Initialization of bean failed; nested exception is java.lang.NoSuchFieldError: org/springframework/core/convert/TypeDescriptor.NULL

From Dev

Initialization of bean failed; nested exception is org.springframework.beans

From Dev

Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException:

From Dev

Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException:

From Dev

Parse JSON exception - cannot deserialize

From Dev

Cannot deserialize instance of `org.json.JSONObject`

From Dev

Cannot deserialize nested JSON using Retrofit (Android)

From Dev

nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.springframework.jdbc.support.SQLErrorCodesFactory

From Dev

Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException: could not execute statement;

From Dev

Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException

From Dev

Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field:

From Dev

Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException

From Dev

JMS Serializer deserialize ArrayCollection of Objects

From Dev

Json Deserialize Exception

From Dev

Deserialize Json to Object Exception

From Dev

Json Deserialize Exception

From Dev

java deserialize exception

From Dev

Deserialize nested level XML

From Dev

Deserialize Nested JSON to Lists

From Dev

Serialize and deserialize nested classes

From Dev

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.NullPointerException in REST with Spring

From Dev

Error creating bean with name 'JobTest': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreat

From Dev

Cannot deserialize a tuple

From Dev

Cannot deserialize Json to object

From Dev

Cannot deserialize type with interface

From Dev

Cannot deserialize type with interface

From Dev

Cannot deserialize a JSON object

Related Related

  1. 1

    Caused by: org.springframework.data.redis.serializer.SerializationException: Cannot deserialize; nested exception is org.springframework.core.seriali

  2. 2

    HTTP Status 500 - Request processing failed; nested exception is org.springframework.web.bind.annotation.support.HandlerMethodInvocationException

  3. 3

    Initialization of bean failed; nested exception is java.lang.NoSuchFieldError: org/springframework/core/convert/TypeDescriptor.NULL

  4. 4

    Initialization of bean failed; nested exception is org.springframework.beans

  5. 5

    Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException:

  6. 6

    Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException:

  7. 7

    Parse JSON exception - cannot deserialize

  8. 8

    Cannot deserialize instance of `org.json.JSONObject`

  9. 9

    Cannot deserialize nested JSON using Retrofit (Android)

  10. 10

    nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.springframework.jdbc.support.SQLErrorCodesFactory

  11. 11

    Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException: could not execute statement;

  12. 12

    Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException

  13. 13

    Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field:

  14. 14

    Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException

  15. 15

    JMS Serializer deserialize ArrayCollection of Objects

  16. 16

    Json Deserialize Exception

  17. 17

    Deserialize Json to Object Exception

  18. 18

    Json Deserialize Exception

  19. 19

    java deserialize exception

  20. 20

    Deserialize nested level XML

  21. 21

    Deserialize Nested JSON to Lists

  22. 22

    Serialize and deserialize nested classes

  23. 23

    org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.NullPointerException in REST with Spring

  24. 24

    Error creating bean with name 'JobTest': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreat

  25. 25

    Cannot deserialize a tuple

  26. 26

    Cannot deserialize Json to object

  27. 27

    Cannot deserialize type with interface

  28. 28

    Cannot deserialize type with interface

  29. 29

    Cannot deserialize a JSON object

HotTag

Archive