我正在尝试使用嵌入的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>此XML摘自“骆驼行动”一书。我(相信我)拥有所有必需的maven依赖项。
更完整的堆栈跟踪:
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 ...发布于 2014-06-23 23:19:58
我想通了。最上面的标记中缺少一行: xmlns:broker="http://activemq.apache.org/schema/core“
发布于 2014-06-23 23:23:06
您需要指定xsd名称空间/ broker ...
<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">https://stackoverflow.com/questions/24369379
复制相似问题