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

前端之家收集整理的这篇文章主要介绍了java.lang.ClassNotFoundException:org.apache.commons.lang.exception.NestableRuntimeException前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图从数据库中检索数据.当我运行程序它显示错误 java.lang.ClassNotFoundException:org.apache.commons.lang.exception.NestableRuntimeException我有json-lib jar文件在我的WEB-INF – > lib目录,我不知道为什么它显示 JSONArray的这个错误.

我的代码是:

  1. StringBuilder sb=new StringBuilder(1024);
  2. sb.append("select * from ").append(uname.trim()).append("vcomments").append(" where itemid=").append(itemId).append(" and albumid=").append(albumId);
  3. sql=sb.toString();
  4. stmt = conn.prepareStatement(sql);
  5. ResultSet rs = stmt.executeQuery();
  6. //ArrayList<String> CommArray=new ArrayList();
  7. JSONArray arrayObj=new JSONArray(); //#100
  8.  
  9.  
  10. while(rs.next()){
  11. Commenter comment = new Commenter();
  12. comment.setUname(rs.getString("uname").trim());
  13. comment.setComment(rs.getString("comments").trim());
  14. arrayObj.add(comment.toString());
  15.  
  16. }
  17. commentObj=gson.toJsonTree(arrayObj);
  18. myObj.add("commentInfo",commentObj);
  19. out.println(myObj.toString());
  20. rs.close();
  21. stmt.close();
  22. stmt = null;
  23.  
  24.  
  25. conn.close();
  26. conn = null;
  27.  
  28. }

控制台的输出是:

  1. SEVERE: Servlet.service() for servlet [VComment] in context with path [/skypark] threw exception [Servlet execution threw an exception] with root cause
  2. java.lang.ClassNotFoundException: org.apache.commons.lang.exception.NestableRuntimeException
  3. at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
  4. at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
  5. at java.lang.ClassLoader.defineClass1(Native Method)
  6. at java.lang.ClassLoader.defineClass(Unknown Source)
  7. at java.security.SecureClassLoader.defineClass(Unknown Source)
  8. at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2904)
  9. at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1173)
  10. at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1681)
  11. at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
  12. at skypark.VComment.doGet(VComment.java:100)
  13. at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
  14. at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
  15. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
  16. at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
  17. at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
  18. at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
  19. at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
  20. at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
  21. at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
  22. at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:931)
  23. at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
  24. at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
  25. at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
  26. at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
  27. at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
  28. at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
  29. at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  30. at java.lang.Thread.run(Unknown Source)

请有人告诉我如何解决这个问题……谢谢….

解决方法

我有同样的问题,和你一样 – 我下载了最新的commons-lang.但实际上我可以通过下载 apache commons-lang 2.6( DDL)并将该jar放在WEB-INF / lib下来解决

希望你在此期间解决了这个问题.

猜你在找的Java相关文章