You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Toby Mathews <xt...@yahoo.com.INVALID> on 2019/11/11 21:52:27 UTC
slf4j class not found exception
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
Re: slf4j class not found exception
Posted by Toby Mathews <xt...@yahoo.com.INVALID>.
Thanks Tilman,
Yes. I created the project from scratch and do not need to use logging at this pointI found a tutorial on-line It has non-copyrighted sample scripts that one can copy and use.
I am just trying to use the PDDocument.textStripper as a starting point.
Since I emailed the group yesterday, I managed to find some slf4j jar file(s) and imported them to the project
Now that the slf4j files are imported, there appears to be some sort of new dependency that seems cryptic to me.
Today, I will try to back out some of the jars I imported as they do not seem necessary. And then trace through my project for other clues.
Thanks for your response.
Toby
On Monday, November 11, 2019, 09:33:27 PM MST, Tilman Hausherr <th...@t-online.de> wrote:
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-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org
Re: slf4j class not found exception
Posted by Tilman Hausherr <TH...@t-online.de>.
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-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org