Exception in thread "main" net.sf.json.JSONException: java.lang.NoSuchMethodException: com.redis.bean.User.<init>()
at net.sf.json.JSONObject.toBean(JSONObject.java:310)
at net.sf.json.JSONObject.toBean(JSONObject.java:255)
at com.redis.util.RedisListUtil.getArraylist(RedisListUtil.java:125)
at com.redis.test.RedisJava.main(RedisJava.java:33)
Caused by: java.lang.NoSuchMethodException: com.redis.bean.User.<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:304)
... 3 more
错误原因:
User实体类 没加无参构造函数
添加后,重新运行,错误消失问题解决