簡體   English   中英

在 Mule 4 模板中調用 Java 方法

[英]Invoke Java method in Mule 4 template

我正在嘗試創建 Mule 4 服務模板並嘗試調用 java 方法,但出現以下錯誤:-

org.xml.sax.SAXParseException; 行號:26; 列數:140; cvc-complex-type.2.4.a:發現以元素“java:invoke-static”開頭的無效內容。 '{" http://www.mulesoft.org/schema/mule/core ":abstract-message-processor, " http://www.mulesoft.org/schema/mule/core ":abstract-mixed-之一預期內容消息處理器}'。

我已經更新了 mule-artifact.json :-

{
  "configs": [
    "implementationservice.xml","globals.xml"
  ],
  "secureProperties": [],
  "redeploymentEnabled": true,
  "name": "implementationservice",
  "minMuleVersion": "4.1.4",
  "requiredProduct": "MULE_EE",
  "classLoaderModelLoaderDescriptor": {
    "id": "mule",
    "attributes": {
      "exportedResources": [],
      "exportedPackages": ["Utilities.systemInfo"]
    }
  },
  "bundleDescriptorLoader": {
    "id": "mule",
    "attributes": {}
  }
}

即使我遇到了同樣的問題,Anypoint studio 在生成配置 xml 時也可能存在一些問題。 您可以添加以下命名空間和架構位置以消除錯誤


<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:java="http://www.mulesoft.org/schema/mule/java" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="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/java http://www.mulesoft.org/schema/mule/java/current/mule-java.xsd"> 

您需要將 Java 模塊添加到 pom.xml。 它是一個可選模塊。

此外,如果您使用最新的 Mule Maven 插件版本(我認為當前是 3.3.1),您可以省略幾乎所有的 mule-artifact.json,它會自動生成。 最小 mule-artifact.json 示例:

{
  "minMuleVersion": "4.1.4",
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM