问题描述
当我升级到activemq-all-5.6.0
When I upgrade to activemq-all-5.6.0
服务器启动时出现此错误
I get this error during server startup
SLF4J:类路径包含多个SLF4J绑定
SLF4J: Class path contains multiple SLF4J bindings
使用activemq-all-5.5.1时,我没有这个问题
I don't have this issue when using activemq-all-5.5.1
经检查,我发现在activemq-all-5.6.0.jar和slf4j-log4j12-1.5.10.jar中都存在StaticLoggerBinder.class
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
请帮助调试此问题
我的pom.xml如下
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>
活动的mq依赖关系是这样的
The active mq dependency is like this
旧版本5.5.1(有效)
Old Version 5.5.1 (This works)
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-all</artifactId>
<version>5.5.1</version>
</dependency>
新版本5.6.0(出现错误)
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>
谢谢.
推荐答案
ActiveMQ人员使用 Maven Shade插件来创建activemq-all" ueber"jar.在5.5.1版和5.6.0版之间的某个地方,他们添加了org.slf4j:slf4j-log4j12依赖性-因此您遇到了问题.
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.
不幸的是,因为他们使用了阴影插件,所以您无法在POM的activemq-all依赖项定义中使用exclusions
.
Unfortunately because they used the shade plugin you can not use exclusions
in your activemq-all dependency definition in your POM.
相反,您将需要用所有必需的单个依赖项完全替换activemq-all依赖项(当然org.sl4j-log4j12除外).
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).
以下页面详细介绍了所有必需的依赖项: http://activemq.apache.org/initial-configuration.html#InitialConfiguration-RequiredJARs
The following page details all the required dependencies:http://activemq.apache.org/initial-configuration.html#InitialConfiguration-RequiredJARs
或者,以下是activemq-all jar中包含的所有依赖项(必需和可选)的列表(取自activemq-all pom中的shade插件的配置):
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
希望有帮助.
这篇关于activemq-all-5.6.0.jar发生多个SLF4J绑定错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!