How to fix ClassNotFoundException: org.apache.commons.logging.LogFactory?

jvd picture jvd · Jul 17, 2014 · Viewed 87.1k times · Source

When i run the app it getting exception

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
    at org.hibernate.dialect.Dialect.<clinit>(Dialect.java:58)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    ... 1 more

I have put all the jar files in lib folder. I don't know how to solve this, where is my mistake.

Answer

Joao Luiz Cadore picture Joao Luiz Cadore · Feb 13, 2016

Add this in your pom file:

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