Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogF

Posted 小兵一枚

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogF相关的知识,希望对你有一定的参考价值。

MyEclipse运行的时候报错,菜鸟不理解是什么意思,最后找了一些资料才知道是因为缺少commons-logging.jar包

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
    at org.apache.commons.httpclient.HttpClient.<clinit>(HttpClient.java:66)
    at com.httputils.HttpUtil.methodPost(HttpUtil.java:26)
    at com.test.UrlTest.main(UrlTest.java:36)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 3 more

解决方案:把commons-logging.jar放到百度里面搜索一下,查询出来结果后,点击第一个Apache官网,下载相应的Jar包,解压,找到jar文件,然后放到你项目WEB-INF/lib里面就可以了

以上是关于Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogF的主要内容,如果未能解决你的问题,请参考以下文章

Exception in thread "main" java.lang.UnsupportedClassVersionError

Exception in thread "main" java.util.InputMismatchException

Exception in thread "main" java.lang.ClassCastException

Exception in thread "main" java.lang.UnsatisfiedLinkError:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1

Exception in thread "main" java.lang.NullPointerException