First, the scene of abnormal occurrence
When you use Netty to do an Android message push, the following exception occurs:
Io.netty.handler.codec.DecoderException:java.io.InvalidClassException:failed to read class descriptor
Obviously, it's a coding-decoding anomaly. second, the cause of the anomaly
In the entire push project, the message is a class of messages that must be converted to byte transmission, so the serializable interface is implemented in the word class, and decoding is transmitted to the client in the server, which is where the error occurs. This is because the message class on the server side is different from the package path of the client's message class, causing the encoding and decoding to be inconsistent and will naturally report an exception. third, the class of exception-solving serialization is best combined with serialversionuid, Without java.io.InvalidClassException, different JVMs may not be able to compute the SERIALVERSIONUID, even if the definition of the class is consistent with the serialized object, and after the serialized object in Jvm-a is reached Jvm-b, Jvm-b believes Class Invalid The path of the server and client-side codec to be consistent