Loading
Salesforce から送信されるメールは、承認済ドメインからのみとなります続きを読む

Troubleshoot "Invalid content was found starting with element" Error in Mule 4

公開日: Aug 4, 2025
ステップ

SYMPTOM

Error "Invalid content was found starting with element '{moduleName}:{xxx}'" thrown during Mule application deployment.
Error Sample
ERROR 2020-04-30 16:08:04,036 [WrapperListener_start_runner] org.mule.runtime.module.deployment.internal.DefaultArchiveDeployer: Failed to deploy artifact [testcustom]
org.mule.runtime.deployment.model.api.DeploymentException: Failed to deploy artifact [testcustom]
Caused by: org.mule.runtime.api.exception.MuleRuntimeException: org.mule.runtime.deployment.model.api.DeploymentInitException: MuleRuntimeException: There was '1' error while parsing the given file 'testcustom.xml'.
Full list:
org.xml.sax.SAXParseException; lineNumber: 15; columnNumber: 108; cvc-complex-type.2.4.a: Invalid content was found starting with element 'basic:sayHi'. One of '{"http://www.mulesoft.org/schema/mule/core":abstract-message-processor, "http://www.mulesoft.org/schema/mule/core":abstract-mixed-content-message-processor, "http://www.mulesoft.org/schema/mule/core":abstract-exception-strategy}' is expected.

Caused by: org.mule.runtime.deployment.model.api.DeploymentInitException: MuleRuntimeException: There was '1' error while parsing the given file 'testcustom.xml'.
Full list:
org.xml.sax.SAXParseException; lineNumber: 15; columnNumber: 108; cvc-complex-type.2.4.a: Invalid content was found starting with element 'basic:sayHi'. One of '{"http://www.mulesoft.org/schema/mule/core":abstract-message-processor, "http://www.mulesoft.org/schema/mule/core":abstract-mixed-content-message-processor, "http://www.mulesoft.org/schema/mule/core":abstract-exception-strategy}' is expected.

Caused by: org.mule.runtime.core.api.config.ConfigurationException: There was '1' error while parsing the given file 'testcustom.xml'.
Full list:
org.xml.sax.SAXParseException; lineNumber: 15; columnNumber: 108; cvc-complex-type.2.4.a: Invalid content was found starting with element 'basic:sayHi'. One of '{"http://www.mulesoft.org/schema/mule/core":abstract-message-processor, "http://www.mulesoft.org/schema/mule/core":abstract-mixed-content-message-processor, "http://www.mulesoft.org/schema/mule/core":abstract-exception-strategy}' is expected.

Caused by: org.mule.runtime.api.exception.MuleRuntimeException: There was '1' error while parsing the given file 'testcustom.xml'.
Full list:
org.xml.sax.SAXParseException; lineNumber: 15; columnNumber: 108; cvc-complex-type.2.4.a: Invalid content was found starting with element 'basic:sayHi'. One of '{"http://www.mulesoft.org/schema/mule/core":abstract-message-processor, "http://www.mulesoft.org/schema/mule/core":abstract-mixed-content-message-processor, "http://www.mulesoft.org/schema/mule/core":abstract-exception-strategy}' is expected.

TROUBLESHOOTING STEPS

Step 1: Check Mule Configuration XML
When we add module operations (processors) to a Mule Application in Anypoint Studio via the Palette, the module corresponding namespace and schema location will be added to Mule configuration XML automatically.
As an example, if we add the HTTP Connector Listener processor into an empty Mule configuration XML, the XML content will change from:
<?xml version="1.0" encoding="UTF-8"?>

<mule 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"></mule>
To
<?xml version="1.0" encoding="UTF-8"?>

<mule 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: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:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config" doc:id="fdb33276-fd19-4862-b557-6608b0c9f9dd" >
		<http:listener-connection host="0.0.0.0" port="8081" />
	</http:listener-config>
</mule>
Note: the HTTP namespace and corresponding schemaLocation are added automatically.

If these configurations are manipulated with wrong value, Mule Runtime will report Invalid content was found since element may not have correct namespace or doesn't match the XML schema.

Step 2: Check pom file
When adding a module to the Palette, the Mule application's pom file will be updated with the corresponding dependencies. The HTTP Connector dependency is added as follow:
<dependency>
  <groupId>org.mule.connectors</groupId>
  <artifactId>mule-http-connector</artifactId>
  <version>1.5.11</version>
  <classifier>mule-plugin</classifier>
</dependency>

Occasionally, the pom file may get corrupted due to manual editing.

Step 3: Check deployed Mule application
When we export a Mule Application as a deployable jar, the dependencies will be added into a generated jar file which will contain the repository directory with all the dependencies added in the pom file.
When deploying aMule application to Mule runtime, the  jar file is unzipped and the application structure can be checked.
Sample of unzipped deployable Mule Application repository directory

repository
    ├── com...
    └── org
        └── mule
            ├── connectors
            ... ├── mule-http-connector
                │   └── 1.5.11
                │       ├── classloader-model.json
                │       └── mule-http-connector-1.5.11-mule-plugin.jar
                └── mule-sockets-connector
                    └── 1.1.5
                        ├── classloader-model.json
                        └── mule-sockets-connector-1.1.5-mule-plugin.jar
If the corresponding module jar file (mule-http-connector-1.5.11-mule-plugin.jar) is missing from the repository folder, the deployment will fail.

Step 4: Check module extension

When above steps seem good we need to further check the underlying module content to find out the root cause.
Mule Runtime loads the module via the Extension API and uses the XML file called "{module}-extension-model.xml" which resides in the module META-INF folder to generate the corresponding schema file used in the Mule configuration file.
"Invalid content was found starting with element" error can be seen when we upgrade a module version (i.e. http connector 1.5.11 to 1.6.0) without changing the Mule configuration XML or using a custom module with incorrect extension module generated.
With http:listener-config example defined at step 1, if the HTTP Connector Listener configuration was changed to http:listener-configuration accidentally as below:

<?xml version="1.0" encoding="UTF-8"?>

<mule 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: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:listener-configuration name="HTTP_Listener_config" doc:name="HTTP Listener config" doc:id="fdb33276-fd19-4862-b557-6608b0c9f9dd" >
		<http:listener-connection host="0.0.0.0" port="8081" />
	</http:listener-configuration>

Unzip the HTTP Connector jar file confirmed at step 3 will have the following directory structure. We only need to check http-extension-descriptions.xml

├── META-INF
│   ├── http-extension-descriptions.xml
│   ├── maven
│   │   └── org.mule.connectors
│   │       └── mule-http-connector
│   │           └── pom.xml
│   ├── mime.types
│   ├── mule-artifact
│   │   ├── icon.svg
│   │   └── mule-artifact.json
│   └── org
│       └── mule
│           └── runtime
│               └── core
| *classes files
└── org
    └── mule
        └── extension
            └── http
                ├── api
                └── internal 
 

Opening http-extension-descriptions.xml shows the following XML snippet under <extension-documentation>-<configs>
 

<config name="listenerConfig">
    <description><![CDATA[Configuration element for a HttpListener.]]></description>
    <parameters>
        <parameter name="basePath">
            <description><![CDATA[Base path to use for all requests that reference this config.]]></description>
        </parameter>
        <parameter name="listenerInterceptors">
            <description><![CDATA[Listener interceptors that will apply on request and on response events.]]></description>
        </parameter>
    </parameters>
</config>

We find that the configuration name is defined as listenerConfig in the extension model. As Mule configuration XML uses lower case with hyphen style rather than CamelCase style naming convention so the correct name in Mule configuration should be listener-config. But cross checking the mule configuration XML, it shows http:listener-configuration, this is incorrect as there is no definition for listener-configuration in the http-extension-descriptions.xml. Correct it to listener-config and the deployment error will be fixed.

In reality, this last issue may happen due to an updated HTTP Connector XML declaration. For example, if the http listener configuration extension model changes from listenerConfig to listenerConfiguration. It could happen in both ways, manual editing of the Mule Configuration, or edit of the extension model. 
This step can be used for addressing typical module updates issues such as Application fails to deploy with an "Invalid content was found starting with element 'reconnect'" error.

Further Reading

Mule Module Structure
FOR MULE 3 -  Getting "org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'xxxxx'"

ナレッジ記事番号

001117206

 
読み込み中
Salesforce Help | Article