Hi,

PDFBox does not require slf4j, so the import isn't needed unless you use it yourself. Maybe something else uses it. The exception NoClassDefFoundError means that slf4j jar file(s) is missing in your class path. So you need to check your project whether it is there or not.

Did you create your project from scratch or did you find something on the web?

Tilman

Am 11.11.2019 um 22:52 schrieb Toby Mathews:
Here are my import statements:
import org.apache.pdfbox.pdmodel.PDDocument;  import 
org.apache.pdfbox.text.PDFTextStripper;  import org.apache.log4j.*;import 
org.apache.logging.*;import org.apache.commons.logging.*;
import org.apache.logging.slf4j.*;
And here is the exception:
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/Logger at 
org.apache.logging.slf4j.SLF4JLoggerContext.getLogger(SLF4JLoggerContext.java:39) at 
org.apache.logging.log4j.jcl.LogAdapter.newLogger(LogAdapter.java:34) at 
org.apache.logging.log4j.jcl.LogAdapter.newLogger(LogAdapter.java:30) at 
org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:54) at 
org.apache.logging.log4j.jcl.LogFactoryImpl.getInstance(LogFactoryImpl.java:40) at 
org.apache.logging.log4j.jcl.LogFactoryImpl.getInstance(LogFactoryImpl.java:55) at 
org.apache.commons.logging.LogFactory.getLog(LogFactory.java:655) at 
org.apache.pdfbox.pdmodel.PDDocument.<clinit>(PDDocument.java:97) at 
pdfBoxTutorial.main(pdfBoxTutorial.java:27)Caused by: java.lang.ClassNotFoundException: 
org.slf4j.Logger at java.net.URLClassLoader.findClass(Unknown Source) at 
java.lang.ClassLoader.loadClass(Unknown Source) at 
sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at 
java.lang.ClassLoader.loadClass(Unknown Source) ... 9 more

Thanks for your patience as I am a "newbie" here.
Toby





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org

Reply via email to