2014-06-23 47 views
0

我正在嘗試使用嵌入式駱駝activemq代理。當我包括我的春節檔以下的XML,我得到的錯誤(在底部更完整的堆棧跟蹤):當聲明ActiveMQ代理時,Camel/Spring出現錯誤:「元素的代理經紀人:代理沒有被綁定」

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 ... 

回答

0

我想通了。從最上面的標籤丟失,是行領域:xmlns:券商= 「http://activemq.apache.org/schema/core」

0

你需要指定broker 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">