ClassNotFoundException: org.slf4j.LoggerFactory
JavaGwtSlf4jJava Problem Overview
I am trying to run GWT RequestFactory and facing this error:
ClassNotFoundException: org.slf4j.LoggerFactory
I have tried to download slf4j-api-1.3.1.jar but it didnt resolve the issue
Any idea exactly which jar I need to download ?
Java Solutions
Solution 1 - Java
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):
slf4j-api-1.7.2.jar
slf4j-simple-1.7.2.jar
I was able to run my program.
Solution 2 - Java
Try downloading jar from here
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.
For slf4j-api jar
file for latest version as of now, please visit this link
For slf4j-simple jar
file for latest version as of now, please visit this link
Solution 3 - Java
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 .
as it describes the following :
> This error is reported when the org.slf4j.impl.StaticLoggerBinder > class could not be loaded into memory. This happens when no > appropriate SLF4J binding could be found on the class path. > > 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. > > 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.
Hope that will help someone .
Solution 4 - Java
For a bit more explanation: keep in mind that the "I" in "api" is interface. The slf4j-api jar only holds the needed interfaces (actually LoggerFactory is an abstract class). You also need the actual implementations (an example of which, as noted above, can be found in slf4j-simple). If you look in the jar, you'll find the required classes under the "org.slf4j.impl" package.
Solution 5 - Java
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)
The download contains multiple jars based on how you want to use SLF4J. 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.
Solution 6 - Java
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,
- right click on the project you want to run,
- go "Properties"->"Java Build Path"->"Add External Jars",
- then go to
file:/usr/lib/Hadoop/client-0.20
, choose the three jars named started by "slf4j".
Then you'll be able to run the job locally. Hope my experience will help someone.
Solution 7 - Java
Add the following JARs to the build path or lib folder of the project:
Solution 8 - Java
add this dependency https://mvnrepository.com/artifact/org.slf4j/slf4j-api/1.7.28
will help fix error
Solution 9 - Java
It needs "slf4j-simple-1.7.2.jar" to resolve the problem.
I downloaded a zip file "slf4j-1.7.2.zip" from http://slf4j.org/download.html. I extracted the zip file and i got slf4j-simple-1.7.2.jar
Solution 10 - Java
I had the same on Android. This is how i fixed it:
including ONLY the file:
slf4j-api-1.7.6.jar
in my libs/ folder
Having any additional slf4j* file, caused the NoClassDefFoundError.
Obviously, the rest of the libs can be there (android-support-v4, etc)
Versions: 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!