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

When I launch the application, it gets an 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 put all the jar files in the lib folder. I don't know how to solve this, where is my mistake.

+7
java apache-commons-logging
source share
5 answers

Add this to your pom file:

 <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.2</version> </dependency> 
+11
source share

It works for me after adding this jar file

General Logging 1.2.jar

You can download it from here .

+2
source share

Include jarernate jar files (especially necessary jars) in the lib folder

 antlr-2.7.7.jar commons-collections-3.2.1.jar dom4j-1.6.1.jar javassist-3.12.1.GA.jar hibernate-core-4.0.1.Final.jar hibernate-commons-annotations-4.0.1.Final.jar hibernate-jpa-2.0-api-1.0.1.Final.jar jboss-logging-3.1.0.CR2.jar jboss-transaction-api_1.1_spec-1.0.0.Final.jar 
0
source share

I had a similar problem: in my project, the solution was to add the following org.apache.commons banks:

Common Log-1.2 Common-dbcp2-2.1.1 Common-pool2-2.4.2

0
source share

For me, the problem is resolved after loading and adding jar "commons-logging-1.2.jar"

0
source share

All Articles