Exception in thread & quot; main & quot; java. lang. NoClassDefFoundError: org/apache/commons/logging/LogFactory, commonslogfactory

Source: Internet
Author: User

Exception in thread "main" java. lang. NoClassDefFoundError: org/apache/commons/logging/LogFactory, commonslogfactory

An exception occurred when learning Spring AOP from scratch when I was writing a Java Web framework:

"C: \ Program Files \ Java \ jdk1.7.0 _ 40 \ bin \ java"-Didea. launcher. port = 7533 "-Didea. launcher. bin. path = D: \ JetBrains \ xxIntelliJ IDEA 2016.3 \ bin "-Dfile. encoding = UTF-8-classpath "C: \ Program Files \ Java \ jdk1.7.0 _ 40 \ jre \ lib \ charsets. jar; C: \ Program Files \ Java \ jdk1.7.0 _ 40 \ jre \ lib \ deploy. jar; C: \ Program Files \ Java \ jdk1.7.0 _ 40 \ jre \ lib \ ext \ access-bridge.jar; C: \ Program Files \ Java \ jdk1.7.0 _ 40 \ jre \ lib \ ext \ dnsns. jar; C: \ Program Files \ Java \ jdk1.7.0 _ 40 \ jre \ lib \ ext \ jaccess. jar; C: \ Program Files \ Java \ jdk1.7.0 _ 40 \ jre \ lib \ ext \ localedata. jar; C: \ Program Files \ Java \ jdk1.7.0 _ 40 \ jre \ lib \ ext \ sunec. jar; C: \ Program Files \ Java \ jdk1.7.0 _ 40 \ jre \ lib \ ext \ sunjce_provider.jar; C: \ Program Files \ Java \ jdk1.7.0 _ 40 \ jre \ lib \ ext \ sunmscapi. jar; C: \ Program Files \ Java \ jdk1.7.0 _ 40 \ jre \ lib \ ext \ sunpkcs11.jar; C: \ Program Files \ Java \ jdk1.7.0 _ 40 \ jre \ lib \ ext \ zipfs. jar; C: \ Program Files \ Java \ jdk1.7.0 _ 40 \ jre \ lib \ javaws. jar; C: \ Program Files \ Java \ jdk1.7.0 _ 40 \ jre \ lib \ jce. jar; C: \ Program Files \ Java \ jdk1.7.0 _ 40 \ jre \ lib \ jfr. jar; C: \ Program Files \ Java \ jdk1.7.0 _ 40 \ jre \ lib \ jfxrt. jar; C: \ Program Files \ Java \ jdk1.7.0 _ 40 \ jre \ lib \ jsse. jar; C: \ Program Files \ Java \ jdk1.7.0 _ 40 \ jre \ lib \ management-agent.jar; C: \ Program Files \ Java \ jdk1.7.0 _ 40 \ jre \ lib \ plugin. jar; C: \ Program Files \ Java \ jdk1.7.0 _ 40 \ jre \ lib \ resources. jar; C: \ Program Files \ Java \ jdk1.7.0 _ 40 \ jre \ lib \ rt. jar; E: \ GitCode \ chapter1 \ target \ classes; C: \ Users \ Administrator \. m2 \ repository \ mysql-connector-java \ 5.1.33 \ mysql-connector-java-5.1.33.jar; C: \ Users \ Administrator \. m2 \ repository \ org \ aopalliance. jar; C: \ Users \ Administrator \. m2 \ repository \ asm \ 2.2.3 \ asm-2.2.3.jar; C: \ Users \ Administrator \. m2 \ repository \ asm-commons \ 2.2.3 \ asm-commons-2.2.3.jar; C: \ Users \ Administrator \. m2 \ repository \ cglib \ cglib-nodep-2.2.2.jar; C: \ Users \ Administrator \. m2 \ repository \ org \ springframework \ spring-aop \ 3.2.2.RELEASE \ spring-aop-3.2.2.RELEASE.jar, C: \ Users \ Administrator \. m2 \ repository \ org \ springframework \ spring-asm \ 3.1.0.RELEASE \ spring-asm-3.1.0.RELEASE.jar, C: \ Users \ Administrator \. m2 \ repository \ org \ springframework \ spring-core \ 3.2.2.RELEASE \ spring-core-3.2.2.RELEASE.jar; D: \ JetBrains \ xxIntelliJ IDEA 2016.3 \ lib \ idea_rt.jar "com.intellij.rt.exe cution. application. appMain springAop. client
Exception in thread "main" java. lang. NoClassDefFoundError: org/apache/commons/logging/LogFactory
At org. springframework. aop. framework. CglibAopProxy. <clinit> (CglibAopProxy. java: 95)
At org. springframework. aop. framework. DefaultAopProxyFactory $ CglibProxyFactory. createCglibProxy (DefaultAopProxyFactory. java: 87)
At org. springframework. aop. framework. DefaultAopProxyFactory. createAopProxy (DefaultAopProxyFactory. java: 62)
At org. springframework. aop. framework. ProxyCreatorSupport. createAopProxy (ProxyCreatorSupport. java: 105)
At org. springframework. aop. framework. ProxyFactory. getProxy (ProxyFactory. java: 98)
At springAop. Client. main (Client. java: 17)
At sun. reflect. NativeMethodAccessorImpl. invoke0 (Native Method)
At sun. reflect. NativeMethodAccessorImpl. invoke (NativeMethodAccessorImpl. java: 57)
At sun. reflect. DelegatingMethodAccessorImpl. invoke (DelegatingMethodAccessorImpl. java: 43)
At java. lang. reflect. Method. invoke (Method. java: 606)
At com.intellij.rt.exe cution. application. AppMain. main (AppMain. java: 147)
Caused by: java. lang. ClassNotFoundException: org. apache. commons. logging. LogFactory
At java.net. URLClassLoader $ 1.run( URLClassLoader. java: 366)
At java.net. URLClassLoader $ 1.run( URLClassLoader. java: 355)
At java. security. AccessController. doPrivileged (Native Method)
At java.net. URLClassLoader. findClass (URLClassLoader. java: 354)
At java. lang. ClassLoader. loadClass (ClassLoader. java: 424)
At sun. misc. Launcher $ AppClassLoader. loadClass (Launcher. java: 308)
At java. lang. ClassLoader. loadClass (ClassLoader. java: 357)
... 11 more

Process finished with exit code 1

 

Cause: the commons-logging.jar package is missing

Solution:

① Add maven dependency:

<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>

Download jar package: http://files.cnblogs.com/files/hujinshui/commons-logging-1.2.zip

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.