首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在声明ActiveMQ broker时,Camel/Spring给出错误:“' broker :broker‘元素的前缀代理未绑定”

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

Stack Overflow用户
提问于 2014-06-23 23:11:26
回答 2查看 425关注 0票数 0

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

代码语言:javascript
复制
Line 13 in XML document ... is invalid; ... The prefix "broker" for element "broker:broker" is not bound

引用的xml:

代码语言:javascript
复制
<broker:broker useJmx="false" persistent="false" brokerName="localhost">
   <broker:transportConnectors>
      <broker:transportConnector uri="tcp://localhost:61616"/>
   </broker:transportConnectors>
</broker:broker>

此XML摘自“骆驼行动”一书。我(相信我)拥有所有必需的maven依赖项。

更完整的堆栈跟踪:

代码语言:javascript
复制
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 13 in XML document from class path resource [META-INF/spring/filecopycontext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 13; columnNumber: 73; The prefix "broker" for element "broker:broker" is not bound.
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)
at ...
EN

回答 2

Stack Overflow用户

发布于 2014-06-23 23:19:58

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

票数 0
EN

Stack Overflow用户

发布于 2014-06-23 23:23:06

您需要指定xsd名称空间/ broker ...

代码语言:javascript
复制
<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">
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24369379

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档