ClassNotFoundException: org.slf4j.LoggerFactory

后端 未结 10 1215
长发绾君心
长发绾君心 2020-11-28 11:53

I am trying to run GWT RequestFactory and facing this error:

ClassNotFoundException: org.slf4j.LoggerFactory

I have tried to download s

相关标签:
10条回答
  • 2020-11-28 12:08

    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 .

    0 讨论(0)
  • 2020-11-28 12:11

    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!

    0 讨论(0)
  • 2020-11-28 12:17

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

    will help fix error

    0 讨论(0)
  • 2020-11-28 12:19

    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.

    0 讨论(0)
  • 2020-11-28 12:20

    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.

    0 讨论(0)
  • 2020-11-28 12:23

    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.

    0 讨论(0)
提交回复
热议问题