【问题标题】:activemq dependency does not work well with logbackactivemq 依赖不能很好地与 logback 一起使用
【发布时间】:2014-03-09 14:57:09
【问题描述】:

在我运行程序的那一刻,我在控制台中得到以下信息:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/.m2/repository/ch/qos/logback/logback-classic/1.1.1/logback-classic-1.1.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/.m2/repository/org/apache/activemq/activemq-all/5.9.0/activemq-all-5.9.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]

正如问题here 中所述,“我们无法使用 maven 依赖排除命令来不获取 activemq-all 贡献的 slf4j-log4j12 工件。” 我不确定我现在是否遵循它的工作。这是否意味着我必须使用 5.10-SNAPSHOT?我打算像这个question 中的答案一样满足于activemq-core,但我需要在5.9.0 中发布的东西,并且核心只升级到5.9。我希望有人可以给我建议。我真的需要帮助。

【问题讨论】:

    标签: java maven dependencies activemq slf4j


    【解决方案1】:

    通常,如果 activemq-all 不能满足您的需求,请从 activemq-client jar 开始。

    旧的 activemq-broker jar 在某些版本之前被切成了几块。

    您可能还希望包含 JMS 规范:

    <dependency>
        <groupId>org.apache.geronimo.specs</groupId>
        <artifactId>geronimo-jms_1.1_spec</artifactId>
        <version>1.1.1</version>
    </dependency>
    

    【讨论】:

    • 我尝试使用activemq-client,但它不包括我需要的东西,那就是用它来制作一个stomp客户端。它无法解析如下导入:import org.apache.activemq.transport.stomp.Stomp;
    • 也可以使用这个:&lt;dependency&gt; &lt;groupId&gt;org.apache.activemq&lt;/groupId&gt; &lt;artifactId&gt;activemq-stomp&lt;/artifactId&gt; &lt;version&gt;5.8.0&lt;/version&gt; &lt;/dependency&gt; ActiveMQ 将依赖项划分为更小的块,这样如果您只需要某些部分,您就不会得到一个臃肿的应用程序。
    • 哦,哇,我需要一记耳光,哈哈。我用 activemq-stomp 替换了 activemq-all,因为这确实是我对 activemq 唯一需要的东西,它现在可以完美运行。谢谢你的帮助,Petter,你是最棒的 :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-11
    • 1970-01-01
    相关资源
    最近更新 更多