Exception thrown while using logback/slf4j

前端 未结 8 622
忘了有多久
忘了有多久 2020-12-09 16:46

I am using slf4j 1.6.2 api jar (tried using 1.6.1 as well) - logback version is 0.9.29 (core & classic). I am using jdk1.6 on ubuntu. The exception I received is copied

相关标签:
8条回答
  • 2020-12-09 17:44

    Also, you must have a many slf4j-api jars of versions mentioned in the []. Try keeping a single version of slf4j-api and the corresponding compatible slf4j-log4j jars in the classpath.

    Mixing different versions of slf4j jars will always be troublesome

    The NoSuchMethodError is due to the discovery of Methods-with-the-same-name more than once, probably coming from the different versions of the same jars

    0 讨论(0)
  • 2020-12-09 17:44

    We have to align the versions of slf4j-api and the corresponding binding, in my case I was using slf4j-log4j12, acording with the documentation of SLF4J:

    http://www.slf4j.org/codes.html#version_mismatch

    I replace the versions of both libraries included as transitive dependencies, putting in my pom this:

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.1</version>
        </dependency>
    
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.1</version>
        </dependency>
    

    I hope this help to somebody.

    Kind regards,

    Jaider

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