• json,junit运行java.lang.NoClassDefFoundError: org/apache/commons/collections/map/ListOrderedMap


    出现java.lang.NoClassDefFoundError: net/sf/ezmorph/Morpher不正确 是因为没有导入ezmorph.jar文件或版本不对。 
      出现java.lang.NoClassDefFoundError: org/apache/commons/collections/map/ListOrderedMap不正确 是因为没有导入commons-collections.jar文件或版本不对。 
      Java代码转换成json代码 
      1.  List集合转换成json代码 
      List list = new ArrayList(); 
      list.add( "first" ); 
      list.add( "second" ); 
      JSONArray jsonArray2 = JSONArray.fromObject( list ); 
      2. Map集合转换成json代码 
      Map map = new HashMap(); 
      map.put("name", "json"); 
      map.put("bool", Boolean.TRUE); 
      map.put("int", new Integer(1)); 
      map.put("arr", new String[] { "a", "b" }); 
      map.put("func", "function(i){ return this.arr[i]; }"); 
      JSONObject json = JSONObject.fromObject(map); 

    我出现是commons-collections.jar版本不对,下载最新版本3.1即运行正确

  • 相关阅读:
    Maven命名约定
    8.30面试
    8.28面试
    8.27面试总结
    vue引入图片之require()
    使用pxtorem时遇到PostCSS plugin postcss-pxtorem requires PostCSS 8
    vue之Missing required prop: "id"
    git首次使用
    vue中style的scoped属性
    JavaScript中的this与function中的this
  • 原文地址:https://www.cnblogs.com/thehappyyouth/p/3103496.html
Copyright © 2020-2023  润新知