user1
user1

Reputation: 499

Class path contains multiple SLF4J bindings

I tried to debug my project but got this

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/storm/lib/logback-classic-1.0.13.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/user/.m2/repository/ch/qos/logback/logback-classic/1.0.13/logback-classic-1.0.13.jar!/org/slf4j/impl/StaticLoggerBinder.class]

what should i do ?

i haven't any dependency for SLF4J in POM just this

<dependency>
        <groupId>org.apache.storm</groupId>
        <artifactId>storm-core</artifactId>
        <version>0.9.6</version>
        <scope>provided</scope>
</dependency>

i tried to use the solutions i found in similar posts but didn't solve it ! like

<exclusions>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>log4j-over-slf4j</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
            </exclusion>
            <exclusion>
                <groupId>logback-classic</groupId>
                <artifactId>ch.qos.logback</artifactId>
            </exclusion>
        </exclusions>

I tried to replace provided to compile but didn't solve it too .

I got this with using mvn dependency:tree

 org.slf4j:log4j-over-slf4j:jar:1.6.6:provided 
 org.slf4j:slf4j-api:jar:1.7.5:compile

Upvotes: 4

Views: 22285

Answers (2)

NUKE
NUKE

Reputation: 79

Following the line of the accepted answer, the way i found to try using just one source of dependencies, was to clone/create again the project i was working on. In my case was an already started project and probably due to poor connection speed, i had a few issues re importing all Maven Projects. So i messed up a bit with the project's settings trying to access all the propper dependencies.

That caused some unexpected changes on my project's pom.xml file that leaded to the error. So, cloning again de project to a new folder and making the maven re import with some decent internet speed just worked fine for me. Hope to be helpful. Regards

Upvotes: 0

Issam El-atif
Issam El-atif

Reputation: 2486

You have 2 sources of dependencies for storm one from /usr/local/storm/lib/ directory and the second from maven which cause multiple binding for sl4j.
Try using just one source of dependencies.

Upvotes: 4

Related Questions