55

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 ?

A.B.
  • 460
  • 5
  • 18
junaidp
  • 10,801
  • 29
  • 89
  • 137

10 Answers10

74

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):

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

I was able to run my program.

A.B.
  • 460
  • 5
  • 18
CharlieL
  • 741
  • 1
  • 5
  • 3
25

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

gprathour
  • 14,813
  • 5
  • 66
  • 90
  • Thanks , error gone , now it says NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder Any idea – junaidp Jan 27 '12 at 07:29
  • get from here http://www.java2s.com/Code/Jar/STUVWXYZ/Downloadslf4jlog4j12156jar.htm – gprathour Jan 27 '12 at 07:30
  • java.lang.IllegalAccessError: tried to access field org.slf4j.impl.StaticLoggerBinder.SINGLETON from class org.slf4j.LoggerFactory – junaidp Jan 27 '12 at 07:39
  • 1
    I tried to visit: http://www.java2s.com/Code/Jar/STUVWXYZ/Downloadslf4japi131jar.htm But, I found the error as: Not Found The requested document was not found on this server. – Ripon Al Wasim Jan 03 '13 at 05:32
  • 4
    The given [url](http://www.java2s.com/Code/Jar/STUVWXYZ/Downloadslf4japi131jar.htm) is not working now, it says __The requested document was not found on this server__. Please update the link – Visruth Feb 05 '13 at 05:34
  • In which of the 21 folders? – clankill3r Nov 21 '19 at 10:26
  • @gprathour Damn your fast :) – clankill3r Nov 21 '19 at 10:58
7

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 .

Community
  • 1
  • 1
3

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.

eze
  • 2,332
  • 3
  • 19
  • 30
2

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.

Patrick
  • 2,672
  • 3
  • 31
  • 47
2

add this dependency https://mvnrepository.com/artifact/org.slf4j/slf4j-api/1.7.28

will help fix error

Vy Do
  • 46,709
  • 59
  • 215
  • 313
1

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.

Bukharov Sergey
  • 9,767
  • 5
  • 39
  • 54
Bofei Yu
  • 11
  • 1
1

Add the following JARs to the build path or lib folder of the project:

  1. slf4j-api-1.7.2.jar
  2. slf4j-jdk14-1.7.2.jar
tarta
  • 5
  • 3
0

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

Ripon Al Wasim
  • 36,924
  • 42
  • 155
  • 176
0

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!

voghDev
  • 5,641
  • 2
  • 37
  • 41