How to gear upwards java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory

Problem : You are getting java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory inward your Java program, which uses logging framework to log messages into log file.  It could last guide dependency or indirect dependency due to whatever framework e.g. Spring, Hibernate or whatever opened upward beginning library similar jackson or whatever other JSON parsing library.


Cause : java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory error comes when yous are using Apache green logging straight or indirectly using framework similar Hibernate, Spring together with commons-logging-1.1.2.jar is non available inward CLASSPATH. Sometime this may last due to around nasty classpath issue, merely most oft this is due to missing JAR inward the classpath.


Solution : If its illustration of missing JAR file therefore effect volition last solved every bit shortly every bit yous deploy the commons-logging-1.1.1.jar or commons-logging-1.1.2.jar inward CLASSPATH, merely deploying JAR manually is irksome together with mistake prone. You necessitate to outset break those JAR files on mesh together with therefore promise that at that spot is no version mismatch mistake e.g. suppose your Spring or Hibernate version is using Apache green logging version 1.1.2 together with yous deployed version 1.1.1, yous mightiness non honour whatever mistake upfront merely it volition neglect inward production every bit shortly every bit novel characteristic which is solely available inward commons-logging-1.1.2.jar is triggered. That's why its best to use Maven to download together with larn by dependency JAR files. Maven volition non solely automatically download the JAR file for yous merely likewise it volition ensure that right version of transitive subject JARs are downloaded.



In guild to add together green logging JAR using Maven, yous tin move add together next dependency inward your pom.xml

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

If yous are using Maven inward Eclipse using M2Eclipse plugin, You tin move fifty-fifty search together with add together dependencies similar below :

 which uses logging framework to log messages into log file How to ready java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory


For manual download, yous tin move become to maven fundamental website together with download commons-logging.jar file.
http://repo1.maven.org/maven2/commons-logging/commons-logging/1.1.2/commons-logging-1.1.2.jar

You tin move fifty-fifty download apache green logging JARs from Apache Commons Logging website every bit well, http://commons.apache.org/logging/download_logging.cgi every bit well.


That's all nearly how to ready java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory mistake inward Java. It tin move come upward fifty-fifty if yous are non using green logging dirctly merely using a library similar Spring, Hibernate, or Struts, which internally uses this library for their logging need. This mistake should last fixed every bit shortly every bit yous set commons-logging-1.1.1.jar file inward your CLASSPATH. If yous encounter this mistake fifty-fifty afterward having commons-logging.jar therefore it agency your CLASSPATH is non laid properly. Follow steps given inward this article to setup your CLASSPATH properly.


Related tutorials together with guide to bargain amongst unlike mistake together with exception inward Java :
  • How to ready java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlObject Error? [solution]
  • How to solve java.lang.NoClassDefFoundError: org/dom4j/DocumentException [solution
  • What is divergence betwixt ClassNotFoundException together with NoClassDefFoundError inward Java? [answer]
  • How to solve java.lang.ClassNotFoundException: com.mysql.jdbc.Driver inward Java? [answer]
  • How to ready java.lang.unsupportedclassversionerror unsupported major.minor version 49.0 50.0 51.0 inward Java [solution]
  • How to Fix java.lang.classnotfoundexception oracle.jdbc.driver.oracledriver [solution
  • 'javac' is non recognized every bit an internal or external command, operable plan or batch file [solution]

Subscribe to receive free email updates:

0 Response to "How to gear upwards java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory"

Posting Komentar