No valid constructor during serialization

前端 未结 2 1725
逝去的感伤
逝去的感伤 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:12

    The class Dydaktyk should have an accessible (public or protected) no-args constructor so that the serialization reflection mechanism can create an instance of the class:

    public Dydaktyk() { 
      ...
    }
    

    From the docs

    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.

提交回复
热议问题