List转换成JSON对象
1、具体错误如下
Exception in thread "main" java.lang.NoClassDefFoundError: net/sf/ezmorph/Morpher at net.sf.json.util.CycleDetectionStrategy.<clinit>(CycleDetectionStrategy.java:37) at net.sf.json.JsonConfig.<clinit>(JsonConfig.java:65) at net.sf.json.JSONArray.addAll(JSONArray.java:1255) at com.you.file.upload.util.ListToJSON.main(ListToJSON.java:49) Caused by: java.lang.ClassNotFoundException: net.sf.ezmorph.Morpher at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 4 more
2、错误原因
lib目录下未导入ezmorph-1.0.6.jar,导致出现错误
3、解决办法
向WEB-INF目录下的lib文件夹中导入ezmorph-1.0.6.jar