简体   繁体   English

ClassNotFoundException: org.slf4j.LoggerFactory

[英]ClassNotFoundException: org.slf4j.LoggerFactory

I am trying to run GWT RequestFactory and facing this error:我正在尝试运行 GWT RequestFactory 并面临此错误:

ClassNotFoundException: org.slf4j.LoggerFactory

I have tried to download slf4j-api-1.3.1.jar but it didnt resolve the issue我尝试下载slf4j-api-1.3.1.jar但它没有解决问题

Any idea exactly which jar I need to download ?知道我需要下载哪个 jar 吗?

Better to always download as your first try, the most recent version from the developer's site最好总是在第一次尝试时下载开发者网站上的最新版本

I had the same error message you had, and by downloading the jar from the above (slf4j-1.7.2.tar.gz most recent version as of 2012OCT13), untarring, uncompressing, adding 2 jars to build path in eclipse (or adding to classpath in comand line):我有与您相同的错误消息,并通过从上面下载 jar(slf4j-1.7.2.tar.gz 截至 2012OCT13 的最新版本),解压缩,解压缩,添加 2 个 jar 以在 eclipse 中构建路径(或添加到命令行中的类路径):

  1. slf4j-api-1.7.2.jar
  2. slf4j-simple-1.7.2.jar

I was able to run my program.我能够运行我的程序。

Try downloading jar from here尝试从这里下载 jar

You can find, it holds the class you need.你会发现,它保存了你需要的类。

EDIT编辑

Seems like the website has changed its structure.该网站似乎已更改其结构。 You need to choose which jar file you need for your project.您需要选择项目所需的 jar 文件。

For slf4j-api jar file for latest version as of now, please visit this link对于slf4j-api jar最新版本的slf4j-api jar文件,请访问此链接

For slf4j-simple jar file for latest version as of now, please visit this link对于slf4j-simple jar最新版本的slf4j-simple jar文件,请访问此链接

i know this is an old Question , but i faced this problem recently and i looked for it in google , and i came across this documentation here from slf4j website .我知道这是一个老问题,但我最近遇到了这个问题,我在谷歌中寻找它,我从 slf4j 网站在这里找到了这个文档。

as it describes the following :因为它描述了以下内容:

This error is reported when the org.slf4j.impl.StaticLoggerBinder class could not be loaded into memory.当 org.slf4j.impl.StaticLoggerBinder 类无法加载到内存时会报告此错误。 This happens when no appropriate SLF4J binding could be found on the class path .当在类路径上找不到合适的 SLF4J 绑定时,就会发生这种情况

Placing one (and only one) of slf4j-nop.jar, slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar or logback-classic.jar on the class path should solve the problem.在类路径上放置一个(并且只有一个) slf4j-nop.jar、slf4j-simple.jar、slf4j-log4j12.jar、slf4j-jdk14.jar 或 logback-classic.jar 应该可以解决问题。

SINCE 1.6.0 As of SLF4J version 1.6 , in the absence of a binding, SLF4J will default to a no-operation (NOP) logger implementation.从 1.6.0 开始,从 SLF4J 版本 1.6 开始,在没有绑定的情况下,SLF4J 将默认为无操作 (NOP) 记录器实现。

Hope that will help someone .希望这会帮助某人。

For a bit more explanation: keep in mind that the "I" in "api" is interface.更多解释:请记住,“api”中的“I”是接口。 The slf4j-api jar only holds the needed interfaces (actually LoggerFactory is an abstract class). slf4j-api jar 只包含需要的接口(实际上 LoggerFactory 是一个抽象类)。 You also need the actual implementations (an example of which, as noted above, can be found in slf4j-simple).您还需要实际的实现(一个例子,如上所述,可以在 slf4j-simple 中找到)。 If you look in the jar, you'll find the required classes under the "org.slf4j. impl " package.如果您在罐子一看,你会发现所需的类下的“org.slf4j。IMPL”包。

You'll need to download SLF4J's jars from the official site as either a zip (v1.7.4) or tar.gz (v1.7.4)您需要从官方网站下载 SLF4J 的 jar 包,可以是zip (v1.7.4)tar.gz (v1.7.4)

The download contains multiple jars based on how you want to use SLF4J.根据您希望如何使用 SLF4J,下载包含多个 jar。 If you're simply trying to resolve the requirement of some other library (GWT, I assume) and don't really care about using SLF4J correctly, then I would probably pick the slf4j-api-1.7.4.jar since the Simple jar suggested by another answer does not contain, to my knowledge, the specific class you're looking for.如果您只是想解决其他一些库的要求(我假设是 GWT)并且并不真正关心正确使用 SLF4J,那么我可能会选择 slf4j-api-1.7.4.jar,因为 Simple jar据我所知,另一个答案所建议的不包含您正在寻找的特定课程。

I got this problem too and I fixed it in this way.我也遇到了这个问题,我就是这样解决的。 I was trying to run mapreduce job locally through Eclipse, after set the configurations, I met this error (in Linux, Virtual Box) To solve it,我试图通过Eclipse在本地运行mapreduce作业,设置配置后,我遇到了这个错误(在Linux,Virtual Box中)来解决它,

  • right click on the project you want to run,右键单击要运行的项目,
  • go "Properties"->"Java Build Path"->"Add External Jars",去“属性”->“Java构建路径”->“添加外部罐子”,
  • then go to file:/usr/lib/Hadoop/client-0.20 , choose the three jars named started by "slf4j".然后转到file:/usr/lib/Hadoop/client-0.20 ,选择以“slf4j”启动的三个jar。

Then you'll be able to run the job locally.然后您将能够在本地运行该作业。 Hope my experience will help someone.希望我的经验能帮到人。

Add the following JARs to the build path or lib folder of the project:将以下 JAR 添加到项目的构建路径或 lib 文件夹中:

  1. slf4j-api-1.7.2.jarslf4j-api-1.7.2.jar
  2. slf4j-jdk14-1.7.2.jar slf4j-jdk14-1.7.2.jar

add this dependency https://mvnrepository.com/artifact/org.slf4j/slf4j-api/1.7.28添加此依赖项https://mvnrepository.com/artifact/org.slf4j/slf4j-api/1.7.28

will help fix error将有助于修复错误

It needs "slf4j-simple-1.7.2.jar" to resolve the problem.它需要“slf4j-simple-1.7.2.jar”来解决这个问题。

I downloaded a zip file "slf4j-1.7.2.zip" from http://slf4j.org/download.html .我从http://slf4j.org/download.html下载了一个 zip 文件“slf4j-1.7.2.zip”。 I extracted the zip file and i got slf4j-simple-1.7.2.jar我解压了 zip 文件,得到了 slf4j-simple-1.7.2.jar

I had the same on Android.我在Android上也有同样的情况。 This is how i fixed it:这是我修复它的方式:

including ONLY the file:仅包括文件:

slf4j-api-1.7.6.jar slf4j-api-1.7.6.jar

in my libs/ folder在我的 libs/ 文件夹中

Having any additional slf4j* file, caused the NoClassDefFoundError.有任何额外的 slf4j* 文件,导致 NoClassDefFoundError。

Obviously, the rest of the libs can be there (android-support-v4, etc)显然,其余的库可以在那里(android-support-v4 等)

Versions: Eclipse Kepler 2013 06 14 - 02 29 ADT 22.3 Android SDK: 4.4.2版本:Eclipse Kepler 2013 06 14 - 02 29 ADT 22.3 Android SDK:4.4.2

Hope someone saves the time i wasted thanks to this!希望有人能节省我浪费的时间!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ClassNotFoundException:org.slf4j.LoggerFactory Maven - ClassNotFoundException: org.slf4j.LoggerFactory Maven 引起:java.lang.ClassNotFoundException:org.slf4j.LoggerFactory - Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory DefaultHttpClient引发原因:java.lang.ClassNotFoundException:org.slf4j.LoggerFactory - DefaultHttpClient throws Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory 从命令行-java.lang.ClassNotFoundException:org.slf4j.LoggerFactory - From command line - java.lang.ClassNotFoundException: org.slf4j.LoggerFactory Websphere 8.5.5上的Solr:与org.slf4j.LoggerFactory的链接错误 - Solr on Websphere 8.5.5 : Linkage Error with org.slf4j.LoggerFactory NoClassDefFoundError:org.slf4j.LoggerFactory是受限制的类 - NoClassDefFoundError: org.slf4j.LoggerFactory is a restricted class java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory - java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory 如何修复NoClassDefFoundError:intelliJ中的org.slf4j.LoggerFactory(但是Eclipse可以正常工作) - How to fix NoClassDefFoundError: org.slf4j.LoggerFactory in intelliJ (but eclipse works fine) Android Studio Jbox2D java.lang.NoClassDefFoundError:org.slf4j.LoggerFactory - Android Studio Jbox2D java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory java:找不到符号符号:类getLogger位置:类org.slf4j.LoggerFactory - java: cannot find symbol symbol: class getLogger location: class org.slf4j.LoggerFactory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM