指定 persistenceAdapter 时 ActiveMQ 代理配置错误:“One of '{WC[##other:”http://activemq.apache.org/schema/core”]}'预计”

发布于 2024-08-31 11:37:04 字数 1572 浏览 1 评论 0原文

我正在设置一个简单的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

唱一曲作罢 2024-09-07 11:37:04

我现在不记得为什么,但有一个无意的更改要求元素必须按字母顺序排列。尝试将 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

被翻牌 2024-09-07 11:37:04

关于字母顺序,Apache ActiveMQ XML Reference 提到:

从 ActiveMQ 5.4 开始,元素内的 XML 元素必须按字母顺序排序。如果您查看 XSD,就会发现 ActiveMQ 一直都是这种情况。 5.4 中的区别在于 XML 配置实际上是根据 XML 模式进行验证的。

您需要遵循 v5.4 之前的架构顺序。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文