一次serialVersionUID引发的血案
作者:互联网
背景:
去掉了两个bean类中重写的equals方法(该equals方法只判断id,相同则true,否则false)
看了看没有什么地方用到了这个equals,就直接去掉了
测试环境出现异常:
org.springframework.core.convert.ConversionFailedException:
Failed to convert from type [byte[]] to type [java.lang.Object] for value '{-84, -19, 0, 5, 115, 114, 0, 61, 111, 114, 103, 46, 115, 112, 114, 105, 110, 103, 102, 114, 97, 109, 101, 119, 111, 114, 107, 46, 115, 101, 99, 117, 114, 105, 116, 121, 46, 99, 111, 114, 101, 46, 99, 111, 110, 116, 101, 120, 116, 46, 83, 101, 99, 117, 114, 105, 116, 121, 67, 111, 110, 116, 101, 120, 116, 73, 109, 112, 108, 0, 0, 0, 0, 0, 0, 1, -112, 2, 0, 1, 76, 0, 14, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 105, 111, 110, 116, 0, 50, 76, 111, 114, 103, 47, 115, 112, 114, 105, 110, 103, 102, 114, 97, 109, 101, 119, 111, 114, 107, 47, 115, 101, 99, 117, 114, 105, 116, 121, 47, 99, 111, 114, 101, 47, 65, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 105, 111, 110, 59, 120, 112, 115, 114, 0, 70, 111, 114, 103, 46, 115, 112, 114, 105, 110, 103, 102, 114, 97, 109, 101, 119, 111, 114, 107, 46, 115, 101, 99, 117, 114, 105, 116, 121, 46, 99, 97, 115, 46, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 105, 111, 110, 46, 67, 97, 115, 65, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 105, 111, 110, 84, 111, 107, 101, 110, 0, 0, 0, 0, 0, 0, 1, -112, 2, 0, 5, 73, 0, 7, 107, 101, 121, 72, 97, 115, 104, 76, 0, 9, 97, 115, 115, 101, 114, 116, 105, 111, 110, 116, 0, 43, 76, 111, 114, 103, 47, 106, 97, 115, 105, 103, 47, 99, 97, 115, 47, 99, 108, 105, 101, 110, 116, 47, 118, 97, 108, 105, 100, 97, 116, 105, 111, 110, 47, 65, 115, 115, 101, 114, 116, 105, 111, 110, 59, 76, 0, 11, 99, 114, 101, 100, 101, 110, 116, 105, 97, 108, 115, 116, 0, 18, 76, 106, 97, 118, 97, 47, 108, 97, 110, 103, 47, 79, 98, 106, 101, 99, 116, 59, 76, 0, 9, 112, 114, 105, 110, 99, 105, 0, 0, 0, 0, 0, 0, 1, -112, 2, 0, 1, 76, 0, 4, 114, 111, 108, 101, 116, 0, 18, 76, 106, 97, 118, 97, 47, 108, 97, 110, 103, 47, 83, 116, 114, 105, 110, 103, 59, 120, 112, 116, 0, 9, 82, 79, 76, 69, 95, 85, 83, 69, 82, 115, 113, 0, 126, 0, 16, 116, 0, 10, 82, 79, 76, 69, 95, 83, 84, 65, 70, 70, 115, 113, 0, 126, 0, 16, 116, 0, 10, 82, 79, 76, 69, 95, 65, 68, 77, 73, 78, 120, 113, 0, 126, 0, 15, 115, 114, 0, 72, 111, 114, 103, 46, 115, 112, 114, 105, 110, 103, 102, 114, 97, 109, 101, 119, 111, 114, 107, 46, 115, 101, 99, 117, 114, 105, 116, 121, 46, 119, 101, 98, 46, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 105, 111, 110, 46, 87, 101, 98, 65, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 105, 111, 110, 68, 101, 116, 97, 105, 108, 115, 0, 0, 0, 0, 0, 0, 1, -112, 2, 0, 2, 76, 0, 13, 114, 101, 109, 111, 116, 101, 65, 100, 100, 114, 101, 115, 115, 113, 0, 126, 0, 17, 76, 0, 9, 115, 101, 115, 115, 105, 111, 110, 73, 100, 113, 0, 126, 0, 17, 120, 112, 116, 0, 11, 49, 48, 46, 50, 46, 50, 49, 46, 49, 55, 57, 116, 0, 36, 97, 101, 51, 101, 54, 51, 102, 54, 45, 101, 102, 98, 99, 45, 52, 50, 97, 100, 45, 98, 54, 98, 53, 45, 99, 98, 98, 100, 101, 51, 97, 98, 98, 50, 101, 97, 58, 26, -22, -35, 115, 114, 0, 45, 111, 114, 103, 46, 106, 97, 115, 105, 103, 46, 99, 97, 115, 46, 99, 108, 105, 101, 110, 116, 46, 118, 97, 108, 105, 100, 97, 116, 105, 111, 110, 46, 65, 115, 115, 101, 114, 116, 105, 111, 110, 73, 109, 112, 108, -108, 50, -72, 39, -31, -120, 90, -53, 2, 0, 5, 76, 0, 10, 97, 116, 116, 114, 105, 98, 117, 116, 101, 115, 116, 0, 15, 76, 106, 97, 118, 97, 47, 117, 116, 105, 108, 47, 77, 97, 112, 59, 76, 0, 18, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 105, 111, 110, 68, 97, 116, 101, 116, 0, 16, 76, 106, 97, 118, 97, 47, 117, 116, 105, 108, 47, 68, 97, 116, 101, 59, 76, 0, 9, 112, 114, 105, 110, 99, 105, 112, 97, 108, 116, 0, 56, 76, 111, 114, 103, 47, 106, 97, 115, 105, 103, 47, 99, 97, 115, 47, 99, 108, 105, 101, 110, 116, 47, 97, 117, 116, 104,12, 119, 8, 0, 0, 0, 16, 0, 0, 0, 10, 116, 0, 4, 109, 97, 105, 108, 116, 0, 14, 119, 122, 120, 105, 97, 64, 116, 114, 105, 112, 46, 99, 111, 109, 116, 0, 4, 99, 105, 116, 121, 116, 0, 6, -28, -72, -118, -26, -75, -73, 116, 0, 11, 100, 105, 115, 112, 108, 97, 121, 78, 97, 109, 101, 116, 0, 25, 66, 114, 97, 117, 109, 32, 88, 105, 97, 32, -17, -68, -120, -27, -92, -113, -26, -106, -121, -26, -77, -67, -17, -68, -119, 116, 0, 4, 110, 97, 109, 101, 116, 0, 5, 119, 122, 120, 105, 97, 116, 0, 17, 100, 105, 115, 116, 105, 110, 103, 117, 105, 115, 104, 101, 100, 78, 97, 109, 101, 116, 0, 85, 67, 78, 61, 120, 119, 122, -27, -92, -113, -26, -106, -121, -26, -77, -67, 44, 79, 85, 61, 85, 115, 101, 114, 44, 79, 85, 61, -25, -77, -69, -25, -69, -97, -25, -96, -108, -27, -113, -111, -23, -125, -88, 44, 79, 85, 61, -28, -72, -118, -26, -75, -73, 44, 68, 67, 61, 99, 110, 49, 44, 68, 67, 61, 103, 108, 111, 98, 97, 108, 44, 68, 67, 61, 99, 116, 114, 105, 112, 44, 68, 67, 61, 99, 111, 109, 116, 0, 7, 99, 111, 109, 112, 97, 110, 121, 116, 0, 5, 70, 85, 45, 73, 84, 11, 98, 97, 108, 44, 68, 67, 61, 99, 116, 114, 105, 112, 44, 68, 67, 61, 99, 111, 109, 44, 32, 67, 78, 61, 83, 116, 111, 99, 107, 115, 44, 79, 85, 61, -24, -127, -116, -25, -70, -89, -25, -69, -124, 44, 79, 85, 61, -28, -70, -70, -28, -70, -117, -25, -69, -124, 44, 79, 85, 61, 85, 115, 101, 114, 71, 114, 111, 117, 112, 44, 68, 67, 61, 99, 110, 49, 44, 68, 67, 61, 103, 108, 111, 98, 97, 108, 44, 68, 67, 61, 99, 116, 11, 97, 110, 103, 46, 66, 111, 111, 108, 101, 97, 110, -51, 32, 114, -128, -43, -100, -6, -18, 2, 0, 1, 90, 0, 5, 118, 97, 108, 117, 101, 120, 112, 1, 113, 0, 126, 0, 83, 113, 0, 126, 0, 83, 113, 0, 126, 0, 36, 116, 0, 12, 120, 119, 122, -27, -92, -113, -26, -106, -121, -26, -77, -67, 112, 116, 0, 9, 101, 115, 112, 97, 97, 115, 33, 33, 33, 116, 0, 5, 119, 122, 120, 105, 97, 113, 0, 126, 0, 68}';
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: com.xxx.xxx.xxx.xxx.User;
local class incompatible: stream classdesc serialVersionUID = -736xxxxxx3867318, local class serialVersionUID = 109xxxxxxx681261
检查:
发现两个类均 implements Serializable
但是没有设置 serialVersionUID
怀疑是序列化反序列化出现异常
补上serialVersionUID重新发布
发到测试后,页面没有挂掉,但是仍然存在大量的类似error,通过其他人的账号登陆,再次出现页面挂掉的场景
继续检查:
发现报错中只是在报User类的异常,另一个bean似乎被忽略了
通过User类联想到session共享
session信息记录了下了,与User重新序列化可能存在冲突
于是将两个相关session表的数据全部清理
异常结束
如何平滑上线?
没有找到完全平滑上线的方法
标签:血案,引发,115,114,116,serialVersionUID,101,97,105 来源: https://blog.csdn.net/qq_33999844/article/details/111004474