将List集合转为json

22 篇文章 0 订阅
9 篇文章 1 订阅

需要导入的jar包

json-lib-2.4-jdk15.jar           下载地址
commons-httpclient-3.1.jar 下载地址
ezmorph-1.0.6.jar               下载地址
morph-1.1.1.zip                  下载地址
commons-lang-2.6.jar        下载地址


如果只导入json-lib-2.4-jdk15.jar会报以下错误

java.lang.reflect.InvocationTargetException

         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

         at java.lang.reflect.Method.invoke(Method.java:498)

         at com.store.web.base.BaseServlet.service(BaseServlet.java:34)

         at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)

         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)

         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

         at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)

         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)

         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

         at com.store.web.filter.EncodingFilter.doFilter(EncodingFilter.java:35)

         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)

         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)

         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)

         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)

         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)

         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)

         at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:651)

         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)

         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)

         at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:412)

         at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)

         at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:754)

         at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1385)

         at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)

         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

         at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

         at java.lang.Thread.run(Thread.java:748)

Caused by: java.lang.NoClassDefFoundError: org/apache/commons/lang/exception/NestableRuntimeException

         at java.lang.ClassLoader.defineClass1(Native Method)

         at java.lang.ClassLoader.defineClass(ClassLoader.java:763)

         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)

         at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2320)

         at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:816)

         at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1261)

         at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1121)

         at com.store.web.servlet.CategoryServlet.findAllCats(CategoryServlet.java:25)

         ... 31 more

Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.exception.NestableRuntimeException

         at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1292)

         at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1121)

         ... 39 more

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值