问题描述
我正在使用Apache PDFBox& POIFSFilesystem从pdf中提取文本并导出到Excel中,但添加apache-log4j-2.8.2-bin jar文件后,我的应用程序抛出错误。我尝试添加org / slf4j / Logger jar文件,但仍然抛出错误。可能是我无法找到确切的文件..! 线程main中的异常java.lang.NoClassDefFoundError:org / slf4j / Logger $ b $ 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:52)
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:80)
加入SLF4J-1.7.25后。我得到了以下错误。它超过了9K行。
SLF4J:类路径包含多个SLF4J绑定。
SLF4J:在[jar:file:/ D:/apache-log4j-2.8.2-bin/log4j-slf4j-impl-2.8.2.jar!/org/slf4j/impl/StaticLoggerBinder.class ]
SLF4J:在[jar:file:/ D:/slf4j-1.7.25/slf4j-android-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]中找到绑定
SLF4J:在[jar:file:/ D:/slf4j-1.7.25/slf4j-jcl-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]中找到绑定
SLF4J:找到绑定[jar:file:/ D:/slf4j-1.7.25/slf4j-jdk14-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J:在[jar:file: /D:/slf4j-1.7.25/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J:在[jar:file:/ D:/ slf4j中找到绑定-1.7.25 / slf4j-nop-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J:在[jar:file:/ D:/slf4j-1.7.25/ slf4j-simple-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J:请参阅http://www.slf4j.org/codes.html#multiple_bindings以获取解释。
SLF4J:实际绑定类型为[org.apache.logging.slf4j.Log4jLoggerFactory]
线程main中的异常java.lang.StackOverflowError $ b $ org.apache.logging.log4j中的异常。 LogManager.getContext(LogManager.java:194)
在org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:122)
在org.apache.logging.slf4j.Log4jLoggerFactory。 getContext(Log4jLoggerFactory.java:43)
at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:46)
at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger( Log4jLoggerFactory.java:29)
通常表示jar文件没有正确提供。从下载slf4j jar文件,然后重试。
此外,最好使用诸如之类的东西来解决所有的依赖关系,以便这些问题可以避免。
I am using Apache PDFBox & POIFSFilesystem which extract text from the pdfs and export into excel but my application is throwing below error ever after adding the apache-log4j-2.8.2-bin jar files.I tried to add org/slf4j/Logger jar files but its still throwing error. may be i could not find exact files..! pls suggest.
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:52)
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:80)
After adding SLF4J-1.7.25. I got below error. its more than 9k lines.
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/D:/apache-log4j-2.8.2-bin/log4j-slf4j-impl-2.8.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/slf4j-1.7.25/slf4j-android-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/slf4j-1.7.25/slf4j-jcl-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/slf4j-1.7.25/slf4j-jdk14-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/slf4j-1.7.25/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/slf4j-1.7.25/slf4j-nop-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/slf4j-1.7.25/slf4j-simple-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Exception in thread "main" java.lang.StackOverflowError
at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194)
at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:122)
at org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:43)
at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:46)
at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:29)
generally means that the jar file is not provided correctly. Download the slf4j jar file from slf4j.org/download and try again.Also, it is always better to use something like Maven to resolve all your dependencies so that these problems can be avoided.
这篇关于如何找到特定的组织/ slf4j /记录器jar文件中的多个绑定从apache zip?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!