zoukankan      html  css  js  c++  java
  • 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


  • 相关阅读:
    数据结构(2)-链表
    数据结构(1)-数组
    SpringMVC学习总结(一)--Hello World入门
    基本数据类型对象的包装类
    关于String的相关常见方法
    常见的集合容器应当避免的坑
    再一次生产 CPU 高负载排查实践
    分表后需要注意的二三事
    线程池没你想的那么简单(续)
    线程池没你想的那么简单
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13315157.html
Copyright © 2011-2022 走看看