關於出現 org.apache.commons.lang.exception.NestableRuntimeException的解決方法
出現了 org.apache.commons.lang.exception.NestableRuntimeException等狀況。實在令人頭大,翻到了一個很好的帖子說明了這個問題。
原文網址如下:1 http://blog.csdn.net/zb0567/article/details/7893063
詳細版 2 https://blog.csdn.net/gu_gu_/article/details/50551775
為方便更多的人解決這個問題,現將原文貼出
原錯誤提示:
七月 24, 2018 9:46:27 上午 org.apache.catalina.core.StandardWrapperValve invoke
嚴重: Servlet.service() for servlet [FindProductByGroup] in context with path [/anbo_test] threw exception [Servlet execution threw an exception] with root cause
java.lang.ClassNotFoundException: org.apache.commons.lang.exception.NestableRuntimeException
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1907)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1750)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:3148)
at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:1388)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1876)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1750)
at Servlet.FindProductByGroupServlet.doPost(FindProductByGroupServlet.java:37)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
ava.lang.ClassNotFoundException: org.apache.commons.lang.exception.NestableRuntimeException
遇到這種問題是因為jar包不全,應該包含
commons-beanutils-1.8.3.jar
commons-lang-2.5.jar
ezmorph-1.0.6.jar
json-lib-2.3-jdk15.jar
但是又出現如下問題:
java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
匯入commons-logging-1.1.1.jar
又出現如下問題:
java.lang.NoClassDefFoundError: Could not initialize class net.sf.json.JSONArray
匯入commons-collections 3.2 OK
我按照這個步驟做了下去,在第一部後就發生了問題即在加入
commons-beanutils-1.8.3.jar
commons-lang-2.5.jar (我加入的是3.版本)*
ezmorph-1.0.6.jar
json-lib-2.3-jdk15.jar
這些包以後仍然出現java.lang.ClassNotFoundException: org.apache.commons.lang.* (其中*代表可能出現的一些情況)。結合後面問題的解決方法,我明白了這是因為comms.lang包有問題,因為我明明已經加入了lang包,但是仍然未能找到。後來在百度上查,看來有很多人都遇到了問題,其中看到了一個非常有價值的評論如圖:
所以我果斷換成了2.*的lang版本。果然最後按照以上作者的步驟順利的解決了所有問題。
為免除大家找jar包的瑪法,我已經貼出了下載的地址,其中包括全部所需要的jar包。下載地址:http://download.csdn.net/detail/gu_gu_/9412495