java string 转化为json_java String 转Json报错
缺少jar包依赖:
java.lang.NoClassDefFoundError: org/apache/commons/beanutils/DynaBean
缺少commons-beanutils-1.8.0.jar
java.lang.NoClassDefFoundError: org/apache/commons/collections/map/ListOrderedMap
缺少commons-collections.jar
java.lang.NoClassDefFoundError: org/apache/commons/lang/exception/NestableRuntimeException
缺少commons-lang-2.4.jar
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
缺少commons-logging-1.1.1.jar
java.lang.NoClassDefFoundError: net/sf/ezmorph/Morpher
缺少ezmorph-1.0.4.jar
java.lang.NoClassDefFoundError: net/sf/json/JSONObject
缺少json-lib-2.3-jdk15.jar
访问servlet是报 java.lang.NoClassDefFoundError: net/sf/json/JSONArray的错误,相关的json的jar包都已经添加至配置路径了依旧报错,原因是没有将这些jar包放入WebContent下的WEB-INF下的lib中。需要先把jar包放入lib中,在添加至配置路径才可以。
以下为maven引入配置:
commons-lang
commons-lang
2.6
net.sf.ezmorph
ezmorph
1.0.6
commons-collections
commons-collections
3.2.2
net.sf.json-lib
json-lib
2.4
jdk15
原文链接:https://blog.csdn.net/weixin_39621235/article/details/114111658