Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory

Tags:

I am using pdfbox in java to convert pdf to images. But when I compile I got the message

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory.

Here is the code I am following. Kindly help me to get out of this error.

like image 559
MLS Avatar asked Sep 26 '11 12:09

MLS


People also ask

What is Exception in thread main Java Lang NoClassDefFoundError?

lang. NoClassDefFoundError is a common error in Java that occurs if a ClassLoader cannot find a particular class in the classpath while trying to load it. The Exception in thread "main" suggests that this error has occurred in the main thread, the thread which is responsible for running the Java application.

How do you fix No class Def Found error?

lang. NoClassDefFoundError, which means the Class Loader file responsible for dynamically loading classes can not find the . class file. So to remove this error, you should set your classpath to the location where your Class Loader is present.

How do I download Apache Commons Logging?

jar : org apache « o « Jar File Download. The download jar file contains the following class files or Java source files.


2 Answers

You need the Apache Commons Logging library on your classpath.

Chances are that you're missing all the dependencies of PDFBox:

Minimum Requirement for PDFBox

  • Java 1.5
  • commons-logging
like image 98
Joachim Sauer Avatar answered Oct 31 '22 00:10

Joachim Sauer


Add commons-logging.jar file to your project classpath. that will fix the issue.

like image 28
Shiva Krish Avatar answered Oct 30 '22 23:10

Shiva Krish