Exception in thread "main" net.sf.json.JSONException: java.lang.NoSuchMethodException: com.lsxy.framework.mq.events.ussd.DelaySendEvent.<init>() at net.sf.json.JSONObject.toBean(JSONObject.java:288) at net.sf.json.JSONObject.toBean(JSONObject.java:233) at com.lsxy.framework.mq.ons.OnsMessageParser.parse(OnsMessageParser.java:37) at com.lsxy.framework.mq.ons.OnsMessageParser.main(OnsMessageParser.java:55) Caused by: java.lang.NoSuchMethodException: com.lsxy.framework.mq.events.ussd.DelaySendEvent.<init>() at java.lang.Class.getConstructor0(Class.java:3082) at java.lang.Class.getDeclaredConstructor(Class.java:2178) at net.sf.json.util.NewBeanInstanceStrategy$DefaultNewBeanInstanceStrategy.newInstance(NewBeanInstanceStrategy.java:55) at net.sf.json.JSONObject.toBean(JSONObject.java:282) ... 3 more
要将json字符创转换成类。需要类提供空构造函数。如果
net.sf.json.JSONException: java.lang.NoSuchMethodException:
这个错的话,大家就检查一下是否是少了构造函数。