【问题标题】:MUnit Configuration errorMUnit 配置错误
【发布时间】:2019-11-08 07:46:07
【问题描述】:

我在 My Mule 项目中有示例 Munit 测试用例。但该文件始终在配置文件开头的<munit:config> 标记处显示错误标记。

注意:但目前我能够执行我的 munit 测试用例。

错误是:

cvc-complex-type.2.4.a:发现无效内容以 元素“单元:配置”。之一 '{"http://www.mulesoft.org/schema/mule/core":注解, “http://www.mulesoft.org/schema/mule/core”:描述,

【问题讨论】:

  • 这是排序的吗?您是否将 munit jar 添加到您的 MuleStudio 项目类路径并且错误消失了?

标签: mule mule-studio


【解决方案1】:

这是一个旧帖子,但我没有看到答案。我有同样的问题:

我有

在声明的顶部。因为我也有,所以我删除了它

xmlns:core="http://www.mulesoft.org/schema/mule/core" 下面。

这修正了错误。

【讨论】:

    【解决方案2】:

    这个错误意味着 munit jar 不在你的类路径中

    【讨论】:

    • 您好,保罗,感谢您的回复。不,错误仍然存​​在。我从一开始就在我的项目构建路径配置中拥有所有依赖于 munit 的 jar。当我从架构位置定义中删除 mule.xsd 时,未显示错误。我相信错误在于 Mule.Xsd 目前我指向 mule.xsd 的以下位置。 mulesoft.org/schema/mule/coremulesoft.org/schema/mule/core/current/mule.xsd
    【解决方案3】:

    检查文件的重复名称或流名称。 即使文件位于不同的文件夹或包中。

    无论如何都要让它们独一无二!

    【讨论】:

      【解决方案4】:

      为了帮助在 Anypoint Studio 6.5 和 munit 工具 3.9.0 中仍然面临此问题的其他任何人和未来的我,我们必须配置 munit 配置全局元素,如下所示

      <mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:munit="http://www.mulesoft.org/schema/mule/munit" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:tls="http://www.mulesoft.org/schema/mule/tls" xmlns:core="http://www.mulesoft.org/schema/mule/core" xmlns:mock="http://www.mulesoft.org/schema/mule/mock" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/munit http://www.mulesoft.org/schema/mule/munit/current/mule-munit.xsd
      http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.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/tls http://www.mulesoft.org/schema/mule/tls/current/mule-tls.xsd
      http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
      http://www.mulesoft.org/schema/mule/mock http://www.mulesoft.org/schema/mule/mock/current/mule-mock.xsd">
      <munit:config mock-connectors="false" mock-inbounds="false" name="munit" 
          doc:name="MUnit configuration"/>
          <spring:beans>
              <spring:import resource="classpath:insurer-sys-api.xml"/>
              <spring:import resource="classpath:global.xml"/>
              <spring:import resource="classpath:insurer-sys-api-claims.xml"/>
              <spring:import resource="classpath:insurer-sys-api-policyValidation.xml"/>
              <spring:import resource="classpath:insurer-ctp-sys-api-shared.xml"/>
              <spring:import resource="classpath:insurer-ctp-sys-api-health.xml"/>
          </spring:beans>
          <http:request-config name="HTTPS_Request_Configuration" protocol="HTTPS" 
          host="localhost" port="8082" basePath="/api" doc:name="HTTP Request 
          Configuration">
              <tls:context>
                  <tls:trust-store insecure="true"/>
              </tls:context>
      
          </http:request-config>
      

      【讨论】:

      • '全局元素如下'在哪里
      • 非常抱歉,我当时是个菜鸟,我没有将 xml 格式化为 stackoverflow '代码块',如果帖子上没有代码块标记,代码文本将永远不会出现!跨度>
      猜你喜欢
      • 2017-05-20
      • 2020-03-18
      • 1970-01-01
      • 1970-01-01
      • 2017-06-28
      • 2016-12-25
      • 2011-10-16
      • 2014-12-28
      相关资源
      最近更新 更多