• List转换成JSON对象报错(四)


    List转换成JSON对象


    1、具体错误如下

    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/collections/map/ListOrderedMap
    	at net.sf.json.JSONObject.<init>(JSONObject.java:1603)
    	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: org.apache.commons.collections.map.ListOrderedMap
    	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)
    	... 5 more
    
    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/collections/map/ListOrderedMap
    	at net.sf.json.JSONObject.<init>(JSONObject.java:1603)
    	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: org.apache.commons.collections.map.ListOrderedMap
    	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)
    	... 5 more
    

    2、错误原因

          lib目录中未导入commons-collections-3.1.jar


    3、解决办法

         向WEB-INF目录下的lib目录导入commons-collections-3.1.jar


  • 相关阅读:
    【iCore、iCore2 双核心板】EPCS 实验(SPI Flash)(基于Verilog语言)
    【iCore2双核心板】SRAM 读写实验(基于Verilog语言)
    大便难案
    乌梅丸案二则
    奔豚
    中医对甲流的认识
    大青龙汤临床应用
    中风之补阳还五汤
    时方的魅力
    艾灸急治
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13315157.html
Copyright © 2020-2023  润新知