Why my exception class needs to be serialized?

前端 未结 3 1067
半阙折子戏
半阙折子戏 2020-12-24 00:47

When you extend a class with class Exception ( for creating new exception) you get a warning to have a serialVersionUID. I know that serialVersionUID

3条回答
  •  暖寄归人
    2020-12-24 01:42

    If your custom exception is ever used in a distributed application (using RMI, Spring http-invoker, whatever) and can be thrown from a server method that is invoked from a remote client, then the exception will have to be serialized to cross the wire and go to the client.

提交回复
热议问题