指定 persistenceAdapter 时 ActiveMQ 代理配置错误:“One of '{WC[##other:”http://activemq.apache.org/schema/core”]}'预计”
我正在设置一个简单的 ActiveMQ 嵌入式代理。它工作正常,直到我尝试配置持久性适配器。我基本上只是从 http://activemq.apache.org/persistence 复制配置。 html#Persistence-ConfiguringKahaPersistence。当我将此配置添加到我的 Spring 配置中时,如下所示:
<?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>
我收到错误:
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.
当我取出 amq:persistenceAdapter 元素时,它工作正常。无论我在主体中包含哪个持久性适配器(例如 jdbc、journal 等),都会发生相同的错误。
任何帮助将不胜感激。
谢谢。
I am setting 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我现在不记得为什么,但有一个无意的更改要求元素必须按字母顺序排列。尝试将 persistenceAdapter 放在 TransportConnectors 之前。
布鲁斯
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
关于字母顺序,Apache ActiveMQ XML Reference 提到:
您需要遵循 v5.4 之前的架构顺序。
Regarding the alphabetical order, the Apache ActiveMQ XML Reference mentions:
You need to follow the order of the schema prior to v5.4.