【问题标题】:Mule- error: cvc-complex-type.2.4.a: Invalid content was found starting with element 'magento:config'Mule-错误:cvc-complex-type.2.4.a:发现以元素'magento:config'开头的无效内容
【发布时间】:2016-03-22 13:11:38
【问题描述】:

我正在尝试在 Anypoint Studio 中运行一个使用 magento 连接器 2.2.0 版的 maven 项目。

这是我项目的 xml 文件:

<mule xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:magento="http://www.mulesoft.org/schema/mule/magento" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/magento http://www.mulesoft.org/schema/mule/magento/current/mule-magento.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd">
 <http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
 <magento:config name="Magento" username="test" password="test$" address="http://127.0.0.1:8000.com/api/v2_soap/" doc:name="Magento"/>
<flow name="magentoFlow">
    <http:listener config-ref="HTTP_Listener_Configuration" path="/magento" doc:name="HTTP"/>
    <magento:get-product config-ref="Magento" doc:name="Magento" productId="1"/>
    <json:object-to-json-transformer doc:name="Object to JSON"/>
</flow>
</mule> 

这是错误:

Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'magento:config'. One of '{"http://www.springframework.org/schema/beans":beans, "http://www.springframework.org/schema/beans":bean, "http://www.springframework.org/schema/context":property-placeholder, "http://www.springframework.org/schema/beans":ref, "http://www.mulesoft.org/schema/mule/core":global-property, "http://www.mulesoft.org/schema/mule/core":configuration, "http://www.mulesoft.org/schema/mule/core":notifications, "http://www.mulesoft.org/schema/mule/core":abstract-extension, "http://www.mulesoft.org/schema/mule/core":abstract-shared-extension, "http://www.mulesoft.org/schema/mule/core":abstract-mixed-content-extension, "http://www.mulesoft.org/schema/mule/core":abstract-agent, "http://www.mulesoft.org/schema/mule/core":abstract-security-manager, "http://www.mulesoft.org/schema/mule/core":abstract-transaction-manager, "http://www.mulesoft.org/schema/mule/core":abstract-shared-transaction-manager, "http://www.mulesoft.org/schema/mule/core":abstract-connector, "http://www.mulesoft.org/schema/mule/core":abstract-shared-connector, "http://www.mulesoft.org/schema/mule/core":abstract-global-endpoint, "http://www.mulesoft.org/schema/mule/core":abstract-exception-strategy, "http://www.mulesoft.org/schema/mule/core":abstract-flow-construct, "http://www.mulesoft.org/schema/mule/core":flow, "http://www.mulesoft.org/schema/mule/core":sub-flow, "http://www.mulesoft.org/schema/mule/core":abstract-model, "http://www.mulesoft.org/schema/mule/core":abstract-interceptor-stack, "http://www.mulesoft.org/schema/mule/core":abstract-filter, "http://www.mulesoft.org/schema/mule/core":abstract-transformer, "http://www.mulesoft.org/schema/mule/core":processor-chain, "http://www.mulesoft.org/schema/mule/core":custom-processor, "http://www.mulesoft.org/schema/mule/core":abstract-empty-processor, "http://www.mulesoft.org/schema/mule/core":invoke, "http://www.mulesoft.org/schema/mule/core":set-payload, "http://www.mulesoft.org/schema/mule/core":abstract-global-intercepting-message-processor, "http://www.mulesoft.org/schema/mule/core":custom-queue-store, "http://www.mulesoft.org/schema/mule/core":abstract-processing-strategy}' is expected.

缺少什么?

【问题讨论】:

    标签: maven mule anypoint-studio


    【解决方案1】:

    以下是否有效?

    <?xml version="1.0" encoding="UTF-8"?>
    <mule
        xmlns:json="http://www.mulesoft.org/schema/mule/json"
        xmlns:magento="http://www.mulesoft.org/schema/mule/magento"
        xmlns:http="http://www.mulesoft.org/schema/mule/http"
        xmlns="http://www.mulesoft.org/schema/mule/core"
        xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
        xmlns:spring="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
    http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.7/mule.xsd
    http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.7/mule-http.xsd
    http://www.mulesoft.org/schema/mule/magento http://www.mulesoft.org/schema/mule/magento/1.2/mule-magento.xsd
    http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/3.7/mule-json.xsd">
        <http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
        <magento:config name="Magento" username="test" password="test$" address="http://127.0.0.1:8000.com/api/v2_soap/" doc:name="Magento"/>
        <flow name="magentoFlow">
            <http:listener config-ref="HTTP_Listener_Configuration" path="/magento" doc:name="HTTP"/>
            <magento:get-product config-ref="Magento" doc:name="Magento" productId="1"/>
            <json:object-to-json-transformer doc:name="Object to JSON"/>
        </flow>
    </mule>
    

    sn-p 的变化:

    1. 添加了 XML 声明行
    2. 将 XSD 的位置更改为特定版本,而不是“当前”。 (不确定是否需要这样做,因为 XSD 可能来自类路径上的 jar)

    【讨论】:

      猜你喜欢
      • 2018-03-04
      • 1970-01-01
      • 1970-01-01
      • 2020-10-31
      • 2011-07-07
      • 2019-01-26
      • 2018-12-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多