how to exclude in maven the slf4j for hector
Asked Answered
F

2

5

In maven dependencies I've added the hector to evaluate the Cassandra

<dependency>
   <groupId>org.hectorclient</groupId>
   <artifactId>hector-core</artifactId>
   <version>1.1-0</version>
</dependency>

and get the following logback message

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/yulia/.m2/repository/org/slf4j/slf4j-  log4j12/1.6.1/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/yulia/.m2/repository/ch/qos/logback/logback-classic/0.9.24/logback-classic-0.9.24.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.

How can I exclude slf4j from the hector dependency ?

Fanya answered 17/7, 2012 at 9:31 Comment(2)
Are you adding a dependency of slf4j using Maven?Herron
No, I have this error when I'm adding the hectorclient in maven. When I'm removing the hector-client from maven, the logback became to work againFanya
S
8

You can do something like this -

<dependency>
   <groupId>org.hectorclient</groupId>
   <artifactId>hector-core</artifactId>
   <version>1.1-0</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
            </exclusions>
</dependency>
Samathasamau answered 17/7, 2012 at 9:37 Comment(2)
I've added, but this doesn't help. I see In the dependencies: org.hectorclient:hector-core -> org.apache.cassandra:cassandra-all -> org.slf4jFanya
what is slf4j jar name Exact nameSamathasamau
F
1

I've found :-) !

this should be as following:

<dependency>
        <groupId>org.hectorclient</groupId>
        <artifactId>hector-core</artifactId>
        <version>1.1-0</version>
        <exclusions>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-log4j12</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

This dependency comes from cassandra-all

Fanya answered 17/7, 2012 at 11:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.