Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.springframework.context.support.AbstractApplicationContext.<init>(AbstractApplicationContext.java:119)
at org.springframework.context.support.AbstractXmlApplicationContext.<init>(AbstractXmlApplicationContext.java:55)
....
at com.client.StoryReader.main(StoryReader.java:15)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
....
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 6 more
If you receive the above NoClassDefFoundError -> ClassNotFoundException stack trace when you run your Java application that is using Apache commons-logging framework, for example commons-logging-1.1.2.jar then maybe you have missed adding this dependency in your pom.xml file,
Add the following dependency in your Maven pom.xml file,
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2.0</version>
</dependency>
You can download the latest Apache common logging jar from their website: http://commons.apache.org/proper/commons-logging/download_logging.cgi
Adding this dependency will solve your problem!
ClassNotFoundException org.apache.commons.logging.LogFactory Java Exception
More Posts related to Java,
- Convert Java Map Collection Object to JSON String using Jackson
- Java Stream flatmap() Examples
- [Fix] Instant java.time.temporal.UnsupportedTemporalTypeException: Unsupported unit: Years
- How to run Java Unit Test cases with Apache Maven?
- How to check if Java main thread is alive
- [Fix] java: incompatible types: incompatible parameter types in lambda expression error
- Parsing CSV file using Java code example (Comma Separated File)
- Unhandled exception type InterruptedException : Java Threads
- Native getClass() method from java.lang.Object Class Explained with examples.
- Java Jackson ObjectMapper Class with Examples
- Java 8 Streams map() with examples
- Java 8 - Convert List to Map Examples
- IntelliJ: Error: Could not find or load main class, java.lang.ClassNotFoundException
- Java Stream with Multiple Filters Example
- How to Clear StringJoiner in Java 8
- Spring 5 IoC Example with application Context XML (ClassPathXmlApplicationContext) and Gradle.
- How to get end of line (EOL) or new line character \r \n in Java
- Spring Boot CRUD Examples using JDBCTemplate
- Delete a File in Java with Examples
- Implementing Insertion Sort Algorithm in Java Program
- Java JDBC Batch Update Example with PreparedStatement
- Java JDBC Select Multiple Records from table as List using PreparedStatement
- [Hibernate] The method buildSessionFactory() from the type Configuration is deprecated
- How to fix Java HTTP java.net.UnknownHostException
- Java 8 Display time in 12 hour AM PM format
More Posts:
- Program 2: Print your name using print() function - 1000+ Python Programs - Python-Programs
- How to Display content of a file in Terminal Screen? - Linux
- [Eclipse] Locate Preferences in macOS - MacOS
- Difference between rustc and cargo build commands - Rust
- Java 8: Find the Max value in a List - Java
- Python: How to add Progress Bar in Console with Examples - Python
- Find Java JRE Installation location Mac OS X - Mac-OS-X
- Mac: Change Screenshot Location - MacOS