SLF4J NoSuchMethodError on LocationAwareLogger

前端 未结 8 1700

This is a question that has been asked before, but unfortunately no solution seems to work for me. I am facing this exception (with abridged stack trace):

ja         


        
相关标签:
8条回答
  • 2020-12-03 07:11

    One Solution.

    Verify on eclipse directory: configuration\org.eclipse.equinox.simpleconfigurator\bundles.info

    slf4j no more one

    0 讨论(0)
  • 2020-12-03 07:13

    I had the same error message, but the solution was different for me. I had to remove to following dependency from the maven pom:

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jcl-over-slf4j</artifactId>
      <version>1.6.1</version>
    </dependency>
    

    After that the error vanishes and everything worked for me.

    0 讨论(0)
  • 2020-12-03 07:14

    We were facing the similar problem and it turned out we had 2 incompatible versions of slf4j jars in the classpath. The class path had the following 2 incompatible versions. After removing the lower versions from the classpath, the problem was fixed.

    slf4j-api-1.6.1.jar
    slf4j-log4j12-1.6.1.jar

    slf4j-api-1.5.11.jar
    slf4j-log4j12-1.5.11.jar

    0 讨论(0)
  • 2020-12-03 07:17

    Solved !!!

    I was having dependency on another project which was using JavaDoc plugin. JavaDoc plugin internally uses Maven-core and Maven-core-2.2.1 uses jcl-over-slf4j: 1.5.6. Maven-core is a parent level jar.

    Now, due to this JCL jar, i was facing this issue. Hence I removed it from the lib folder of weblogic(or whatever server you might be using).

    And ALAS !! The problem was resolved.

    Note 1:- You can also use Maven's <exclusion> tag to remove this dependency from the JavaDoc(or any other plugin) to resolve this issue.

    Note 2:- Use the Dependency Hierarchy tab in POM to see if any such old SLF4J jars are present. And remove rest and keep only one version.

    Hope it helps ..

    0 讨论(0)
  • 2020-12-03 07:24

    The javadocs for NoSuchMethodError say,

    Normally, this error is caught by the compiler; this error can only occur at run time if the definition of a class has incompatibly changed.

    So this is probably being caused by incompatible versions of slf4j being loaded. Rather than looking at your classpath and guessing where classes are loaded, find where your class is loaded as described here.

    Print out where org.slf4j.spi.LocationAwareLogger, org.apache.commons.logging.impl.SLF4JLocationAwareLog and org.slf4j.Marker are being loaded from.

    0 讨论(0)
  • 2020-12-03 07:26

    I had quartz scheduler in my pom file, which included slf4j, so I excluded it:

    <exclusion>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
    </exclusion>
    

    and worked!

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