javamavenapache-stormslf4j

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

Solution

  • 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.