Active MQ无法在Apache Camel下运行

时间:2016-12-06 12:02:00

标签: java apache-camel activemq

尝试连接到Active MQ上的队列时,我收到以下错误消息。

Failed to create route ...because of Failed to resolve endpoint: amq://queue:ROBOMQ.TO.MPM due to: Password must also be provided when using username/password as credentials.

下面的Camel XML中的AMQ bean声明。已经工作了好几个月但现在已经停止了。

<bean id="amq" class="org.apache.activemq.camel.component.ActiveMQComponent">
    <property name="brokerURL" value="tcp://127.0.0.1:61616" />
    <property name="userName" value="${username}" />
    <property name="password" value="${password}" />
</bean>

有什么想法吗?

1 个答案:

答案 0 :(得分:5)

原因是项目中的Camel版本已从2.16更改为2.18,因此bean声明也需要更改,并且显式定义了连接工厂。

FROM:

<bean id="amq" class="org.apache.activemq.camel.component.ActiveMQComponent">
    <property name="brokerURL" value="tcp://127.0.0.1:61616" />
    <property name="userName" value="system" />
    <property name="password" value="manager" />

TO:

<bean id="amq" class="org.apache.activemq.camel.component.ActiveMQComponent">
    <property name="connectionFactory">
      <bean class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL" value="tcp://127.0.0.1:61616" />
        <property name="userName" value="system" />
        <property name="password" value="manager" />
      </bean>
    </property>
  </bean>