org.codehaus.jackson.map.JsonMappingException: No suitable constructor found for type [si

来源:互联网 发布:中控考勤机软件 编辑:程序博客网 时间:2024/05/02 17:03

异常:

Caused by: org.codehaus.jackson.map.JsonMappingException: No suitable constructor found for type [simple type, class xxxxx]: can not instantiate from JSON object (need to add/enable type information?)

原因:

被转换json的类中,使用了带参数的构造方法,而忘记初始化原始构造方法,即,这个类没有了无参的初始化构造方法;

这种情况下,无法对该类进行实例化,没有办法进行toJson操作。

解决办法:

1.类中初始化默认构造方法;


0 0
原创粉丝点击