No valid constructor during serialization

前端 未结 2 1727
逝去的感伤
逝去的感伤 2021-01-13 03:39

I have a major problem during loading the extension into the program. I get an exception as there is no valid constructor.

The problem is in the line:

2条回答
  •  再見小時候
    2021-01-13 04:11

    As specified in Oracle site about Serialization interface :

    During deserialization, the fields of non-serializable classes will be initialized using the public or protected no-arg constructor of the class. A no-arg constructor must be accessible to the subclass that is serializable. The fields of serializable subclasses will be restored from the stream.

    What I gues is that Dydaktyk is the subclass of some class. And you have defined the parametric constructor within the superclass and have not defined a parameter-less constructor within it . And the compiler isn't inserting a default constructor for that superclass. So , You should define a parameter-less constructor within your superclass also.

提交回复
热议问题