Camel/Spring在声明ActiveMQ代理时给出错误:“未绑定元素‘broker:broker’的前缀broker”
我正在尝试使用嵌入的camel-activemq代理。当我在Spring文件中包含以下xml时,我会在底部获得更完整的堆栈跟踪错误: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
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">