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

java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory  or "Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory" exception comes when you don't apache commons-logging-1.1.1.jar in your Classpath. I have faced this exception many times while using open source framework like Struts, Spring and Displaytag which uses commons-logging framework for logging. commons-logging is not an actual java logging framework but provides a wrapper so that you can use log4j, java logging or any other Java logging framework. commons-logging is also smart enough to detect which logging framework are you using e.g if you are using log4j it can detect it by looing log4j.jar in your classpath. but if you don't have commons-logging.jar in your classpath you may get java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory at runtime even if your application gets deployed successfully.
Read more »

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

Posting Komentar