下面是一个简单的spring引导项目(版本1.5.2)来演示这个问题:
https://github.com/lanwen/camel-jms-activemq-test
它有Apache 版本2.18.3
在分支master上,由于activemq-camel=5.14.4和camel-jms=2.16.3 (从它那里得到过渡),所有的工作都很好。
Spring引导应用程序通常以日志启动:
2017-04-22 00:53:19.647 INFO 97217 --- [ main] o.a.camel.spring.SpringCamelContext : Apache Camel 2.18.3 (CamelContext: camel-1) is starting
2017-04-22 00:53:19.662 INFO 97173 --- [ main] o.apache.activemq.broker.BrokerService : Apache ActiveMQ 5.14.4 (localhost, ID:lanwen-osx3.local-62145-1492811599544-0:1) is starting
2017-04-22 00:53:19.665 INFO 97173 --- [ main] o.apache.activemq.broker.BrokerService : Apache ActiveMQ 5.14.4 (localhost, ID:lanwen-osx3.local-62145-1492811599544-0:1) started
2017-04-22 00:53:19.665 INFO 97173 --- [ main] o.apache.activemq.broker.BrokerService : For help or more information please see: http://activemq.apache.org
2017-04-22 00:53:19.682 INFO 97173 --- [ main] o.a.activemq.broker.TransportConnector : Connector vm://localhost started
2017-04-22 00:53:19.702 INFO 97173 --- [ main] o.a.camel.spring.SpringCamelContext : Route: route1 started and consuming from: activemq://queue:to-write?asyncConsumer=true
2017-04-22 00:53:19.703 INFO 97173 --- [ main] o.a.camel.spring.SpringCamelContext : Total 1 routes, of which 1 are started.
2017-04-22 00:53:19.704 INFO 97173 --- [ main] o.a.camel.spring.SpringCamelContext : Apache Camel 2.18.3 (CamelContext: camel-1) started in 0.466 seconds
2017-04-22 00:53:19.709 INFO 97173 --- [ main] ru.yandex.test.writer.MyTestApplication : Started MyTestApplication in 2.437 seconds (JVM running for 2.911)但是当您从camel-jms=2.18.3开始(作为骆驼的主要版本,在分支工作中上)
这个日志出了问题:
2017-04-22 00:56:38.070 INFO 97195 --- [ main] o.a.camel.spring.SpringCamelContext : Apache Camel 2.18.3 (CamelContext: camel-1) is starting
...
2017-04-22 00:56:43.590 WARN 97195 --- [ActiveMQ Task-1] o.a.a.t.failover.FailoverTransport : Failed to connect to [tcp://localhost:61616] after: 10 attempt(s) continuing to retry.但是如果我们用activemq-camel把5.13.4换成camel-jms=2.18.3,它又能正常工作了.
为什么ActiveMQ 5.14.x不适用于camel-jms 2.18.x
发布于 2017-05-09 20:03:01
如果您查看最新的Camel ActiveMQ 1.15.5 (https://mvnrepository.com/artifact/org.apache.activemq/activemq-camel/5.14.5)的依赖列表,您会发现它已经将camel-jms作为依赖项,但版本是1.16.3。因此,不需要在POM中单独添加camel-jms 1.18.x依赖项,因为它将覆盖ActiveMQ已经使用的1.16.x版本,这是兼容的版本。
因此,从本质上讲,问题在于您试图使用一个更新的、不兼容的camel-jms版本。当您单独添加1.18.x camel-jms依赖项时,ActiveMQ组件将使用此版本,该版本与其1.16.x版本不兼容,因此出现错误。
如果您需要使用ActiveMQ,那么您可能需要查看camel-jms 1.16.x是否适合您。
https://stackoverflow.com/questions/43552682
复制相似问题