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.lang.ClassCastException: cannot assign instance of java.util.ArrayList to field SomeObject.foo of type java.util.Set in instance of SomeObject

Stack Overflow | Christophe L | 9 months ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    How can I configure Spring Cache to ignore cache serialization errors?

    Stack Overflow | 9 months ago | Christophe L
    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.lang.ClassCastException: cannot assign instance of java.util.ArrayList to field SomeObject.foo of type java.util.Set in instance of SomeObject

    Root Cause Analysis

    1. 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.lang.ClassCastException: cannot assign instance of java.util.ArrayList to field SomeObject.foo of type java.util.Set in instance of SomeObject

      at org.springframework.data.redis.serializer.JdkSerializationRedisSerializer.deserialize()
    2. Spring Data Redis
      RedisCache.get
      1. org.springframework.data.redis.serializer.JdkSerializationRedisSerializer.deserialize(JdkSerializationRedisSerializer.java:41)[spring-data-redis-1.6.4.RELEASE.jar:na]
      2. org.springframework.data.redis.cache.RedisCache$CacheValueAccessor.deserializeIfNecessary(RedisCache.java:378)[spring-data-redis-1.6.4.RELEASE.jar:na]
      3. org.springframework.data.redis.cache.RedisCache.get(RedisCache.java:144)[spring-data-redis-1.6.4.RELEASE.jar:na]
      4. org.springframework.data.redis.cache.RedisCache.get(RedisCache.java:94)[spring-data-redis-1.6.4.RELEASE.jar:na]
      4 frames
    3. Spring Context
      CacheInterceptor.invoke
      1. org.springframework.cache.interceptor.AbstractCacheInvoker.doGet(AbstractCacheInvoker.java:68)[spring-context-4.2.7.RELEASE.jar:4.2.7.RELEASE]
      2. org.springframework.cache.interceptor.CacheAspectSupport.findInCaches(CacheAspectSupport.java:466)[spring-context-4.2.7.RELEASE.jar:4.2.7.RELEASE]
      3. org.springframework.cache.interceptor.CacheAspectSupport.findCachedItem(CacheAspectSupport.java:432)[spring-context-4.2.7.RELEASE.jar:4.2.7.RELEASE]
      4. org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:336)[spring-context-4.2.7.RELEASE.jar:4.2.7.RELEASE]
      5. org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:302)[spring-context-4.2.7.RELEASE.jar:4.2.7.RELEASE]
      6. org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:61)[spring-context-4.2.7.RELEASE.jar:4.2.7.RELEASE]
      6 frames
    4. Spring AOP
      JdkDynamicAopProxy.invoke
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)[spring-aop-4.2.7.RELEASE.jar:4.2.7.RELEASE]
      2. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)[spring-aop-4.2.7.RELEASE.jar:4.2.7.RELEASE]
      2 frames
    5. com.sun.proxy
      $Proxy175.myCachedMethod
      1. com.sun.proxy.$Proxy175.myCachedMethod(Unknown Source)[na:na]
      1 frame