public void testRedisListPop() {String redisKey = "testGoodsKey";
// 使用管道从redis list结构中批量获取元素List objects = redisTemplate.executePipelined((RedisConnection redisConnection) -> {// 打开管道redisConnection.openPipeline();
for (int i = 0;
i < 2;
i++) {redisConnection.rPop(redisKey.getBytes());
}return null;
});
System.out.println(objects);
}
报错详情:反序列化失败
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.StreamCorruptedException: invalid stream header: 31303030 ... 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.StreamCorruptedException: invalid stream header: 31303030 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) ... 39 more Caused by: java.io.StreamCorruptedException: invalid stream header: 31303030 at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:899) at java.io.ObjectInputStream.(ObjectInputStream.java:357) at org.springframework.core.ConfigurableObjectInputStream.(ConfigurableObjectInputStream.java:63) at org.springframework.core.ConfigurableObjectInputStream.(ConfigurableObjectInputStream.java:49) at org.springframework.core.serializer.DefaultDeserializer.deserialize(DefaultDeserializer.java:68) at org.springframework.core.serializer.support.DeserializingConverter.convert(DeserializingConverter.java:73) ... 41 more