Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Camel/Spring在声明ActiveMQ代理时给出错误:“未绑定元素‘broker:broker’的前缀broker”_Spring_Apache Camel_Activemq - Fatal编程技术网

Camel/Spring在声明ActiveMQ代理时给出错误:“未绑定元素‘broker:broker’的前缀broker”

Camel/Spring在声明ActiveMQ代理时给出错误:“未绑定元素‘broker:broker’的前缀broker”,spring,apache-camel,activemq,Spring,Apache Camel,Activemq,我正在尝试使用嵌入的camel-activemq代理。当我在Spring文件中包含以下xml时,我会在底部获得更完整的堆栈跟踪错误: Line 13 in XML document ... is invalid; ... The prefix "broker" for element "broker:broker" is not bound 引用的xml: <broker:broker useJmx="false" persistent="false" brokerName="local

我正在尝试使用嵌入的camel-activemq代理。当我在Spring文件中包含以下xml时,我会在底部获得更完整的堆栈跟踪错误:

Line 13 in XML document ... is invalid; ... The prefix "broker" for element "broker:broker" is not bound
引用的xml:

<broker:broker useJmx="false" persistent="false" brokerName="localhost">
   <broker:transportConnectors>
      <broker:transportConnector uri="tcp://localhost:61616"/>
   </broker:transportConnectors>
</broker:broker>

我想出来了。最上面的标记缺少一行:xmlns:broker=http://activemq.apache.org/schema/core

您需要指定代理XML命名空间/xsd

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:broker="http://activemq.apache.org/schema/core"
       xsi:schemaLocation="
          http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
          http://camel.apache.org/schema/spring
          http://camel.apache.org/schema/spring/camel-spring.xsd
          http://activemq.apache.org/schema/core
          http://activemq.apache.org/schema/core/activemq-core.xsd">
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:broker="http://activemq.apache.org/schema/core"
       xsi:schemaLocation="
          http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
          http://camel.apache.org/schema/spring
          http://camel.apache.org/schema/spring/camel-spring.xsd
          http://activemq.apache.org/schema/core
          http://activemq.apache.org/schema/core/activemq-core.xsd">