multiple SLF4J bindings Error with activemq-all-5.6.0.jar
Asked Answered
V

3

27

When I upgrade to activemq-all-5.6.0

I get this error during server startup

SLF4J: Class path contains multiple SLF4J bindings

I don't have this issue when using activemq-all-5.5.1

On checking I do find that there StaticLoggerBinder.class in both activemq-all-5.6.0.jar and slf4j-log4j12-1.5.10.jar which is causing the issue

Please do help in debugging this issue

My pom.xml is as follows

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.5.10</version>
</dependency>
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>jcl-over-slf4j</artifactId>
    <version>1.5.10</version>
    <scope>runtime</scope>
</dependency>
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <version>1.5.10</version>
    <scope>runtime</scope>
</dependency>

The active mq dependency is like this

Old Version 5.5.1 (This works)

<dependency>
    <groupId>org.apache.activemq</groupId>
    <artifactId>activemq-all</artifactId>
    <version>5.5.1</version>
</dependency>

New Version 5.6.0 (This gives the error)

<dependency>
    <groupId>org.apache.activemq</groupId>
    <artifactId>activemq-all</artifactId>
    <version>5.6.0</version>
</dependency>

Thanks in advance.

Visually answered 2/8, 2012 at 21:44 Comment(0)
C
46

The ActiveMQ guys use the Maven Shade Plugin to create the activemq-all "ueber" jar. Somewhere between version 5.5.1 and 5.6.0 they added the org.slf4j:slf4j-log4j12 dependency - hence your problem.

Unfortunately because they used the shade plugin you can not use exclusions in your activemq-all dependency definition in your POM.

Instead you will need to completely replace the activemq-all dependency with all the required individual dependencies (except of course the org.sl4j-log4j12 one).

The following page details all the required dependencies: http://activemq.apache.org/initial-configuration.html#InitialConfiguration-RequiredJARs

Alternatively the following is the list of all dependencies (required and optional) included in the activemq-all jar (taken from the configuration of the shade plugin in the activemq-all pom):

org.apache.activemq:activemq-camel
org.apache.activemq:activemq-core
org.apache.activemq:activemq-console
org.apache.activemq:activemq-jaas
org.apache.activemq:activemq-optional
org.apache.activemq:kahadb
org.apache.geronimo.specs:geronimo-jms_1.1_spec
org.apache.geronimo.specs:geronimo-jta_1.0.1B_spec
org.apache.geronimo.specs:geronimo-j2ee-management_1.1_spec
org.apache.geronimo.specs:geronimo-annotation_1.0_spec
org.slf4j:slf4j-api
org.slf4j:slf4j-log4j12
log4j:log4j

Hope that helps.

Conjunct answered 2/8, 2012 at 22:14 Comment(2)
Thanks .. taht helps a lot in understndingVisually
Why in the world do the Apache guys keep making these "ueber" jars?!? I just got bit by ApacheDS-all including a slf4j version that conflicts with another version on my path. I should add, spring-ldap-test includes ApacheDS-all as a dependency, which means when I add spring-ldap-test to my spring-boot project, the app blows up. Ugh.Synaeresis
A
16

I had the same problem while using Spring. What helped me was replacing the dependency of activemq-all with:

<dependency>
    <groupId>org.apache.activemq</groupId>
    <artifactId>activemq-spring</artifactId>
    <version>5.14.3</version>
</dependency>

Hope this will help anyone...

Alyssaalyssum answered 23/2, 2017 at 8:33 Comment(0)
B
0

Try excluding the below slf4j/log4j dependencies

<exclusions>

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

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

  <exclusion>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-slf4j2-impl</artifactId>
  </exclusion>

  <exclusion>
    <groupId>org.slf4j</groupId>
    <artifactId>jcl-over-slf4j</artifactId>
  </exclusion>

  <exclusion>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
  </exclusion>

</exclusions>
Bethannbethanne answered 13/4, 2024 at 18:41 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.