开发者

ActiveMQ broker configuration error when specifying persistenceAdapter: "One of '{WC[##other:"http://activemq.apache.org/schema/core"]}' is expected"

I am setting 开发者_JAVA百科up a simple ActiveMQ embedded broker. It works fine, until I try to configure a persistence adapter. I am basically just copying the configuration from http://activemq.apache.org/persistence.html#Persistence-ConfiguringKahaPersistence. When I add this configuration to my Spring configuration, like so:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:amq="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://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core-5.3.0.xsd">

<amq:broker useJmx="true" persistent="true" brokerName="localhost">
    <amq:transportConnectors>
        <amq:transportConnector name="vm" uri="vm://localhost"/>            
    </amq:transportConnectors>
   <amq:persistenceAdapter>
    <amq:kahaPersistenceAdapter directory="activemq-data" maxDataFileLength="33554432"/>
   </amq:persistenceAdapter>
  </amq:broker>
   </beans>

I get the error:

cvc-complex-type.2.4.a: Invalid content was found starting with element 'amq:persistenceAdapter'. 
 One of '{WC[##other:"http://activemq.apache.org/schema/core"]}' is expected.

When I take out the amq:persistenceAdapter element, it works fine. The same error happens no matter which persistence adapter I include in the body, e.g. jdbc, journal, etc.

Any help would be greatly appreciated.

Thanks.


I can't recall why at the moment, but there was an unintentional change that required the elements must be in alphabetical order. Try putting the persistenceAdapter before the transportConnectors.

Bruce


Regarding the alphabetical order, the Apache ActiveMQ XML Reference mentions:

Beginning in ActiveMQ 5.4, the XML elements inside the element must be ordered alphabetically. If you look at the XSD, this has always been the case with ActiveMQ. The difference in 5.4 is that the XML configuration is actually being validated against the XML schema.

You need to follow the order of the schema prior to v5.4.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜