2017-04-21 85 views
14

下面是簡單的彈簧引導工程(版本1.5.2)來演示該問題:爲什麼ActiveMQ的5.14.x無法啓動嵌入駱駝的JMS組件2.18.3

https://github.com/lanwen/camel-jms-activemq-test

阿帕奇駱駝版本2.18.3

分支master一切工作正常,因爲activemq-camel=5.14.4camel-jms=2.16.3(從中得到及物動詞)

春季啓動應用程序與日誌正常啓動:

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開始(如駱駝的主要版本,分支not_working

事情出錯,該日誌:

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.4camel-jms=2.18.3它再次正常工作...

爲什麼ActiveMQ的5.14.x不與駱駝的JMS 2.18.x工作?

+0

我有駱駝版本= 2.18.0和ActiveMQ的版本5.14.1 =一個項目,它做工精細。可以添加更多的痕跡? –

+0

您是否嘗試過示例項目? https://github.com/lanwen/camel-jms-activemq-test。也請檢查您的駱駝JMS版本是不知道2.16.x – lanwen

回答

2

如果你看一下最新的駱駝的ActiveMQ 1.15.5https://mvnrepository.com/artifact/org.apache.activemq/activemq-camel/5.14.5)依賴列表中,你會發現它已經camel-jms作爲依賴,但版本1.16.3。所以,沒有必要爲你單獨添加camel-jms1.18.x依賴於你的POM,因爲這將覆蓋的ActiveMQ已經使用,這是一個兼容的1.16.x版本。

所以基本上,問題是您正在嘗試使用更新的不兼容版本camel-jms。當您單獨添加1.18.xcamel-jms依賴,該組元的ActiveMQ將使用這個版本,這是不符合其1.16.x版本兼容,因此,該錯誤。

如果您需要使用ActiveMQ,那麼您可能需要查看camel-jms1.16.x是否適合您。

+0

,我知道它有這個版本的依賴。但問題是,它不通過你默認工作簡單地使用駱駝BOM,和/或彈簧引導BOM。問題是爲什麼它不能完全在這個版本的組合中工作,並仍然與另一個版本兼容 – lanwen