<Loggers>
...
<AsyncLogger name="org.mule.module.json" level="DEBUG"/>
...
</Loggers>
Troubleshooting JSON Module - Mule 4
To troubleshoot JSON module, become familiar with the information about enabling verbose logging and interpreting commonly thrown messages.
Enable Verbose Logging
To get a better understanding of why an application’s interaction with the JSON module is failing, temporarily enable verbose logging for the module.
Remember to always disable the enhanced verbosity after troubleshooting, because it affects your Mule application performance.
To enable verbose logging in the configuration file:
-
Access Anypoint Studio and navigate to the Package Explorer view.
-
Open your application’s project name.
-
Open the
src/main/resources
path folder. -
Open the
log4j2.xml
file inside the folder. -
Add an
<AsyncLogger>
tag inside the<Loggers>
tag: -
Save your application changes.
-
Click the project name in Package Explorer and then click Run > Run As > Mule Application.
Troubleshoot an Invalid JSON Payload with Trailing Characters
The JSON module Validate schema operation now correctly detects an invalid JSON payload with trailing characters.
To do so, you must add the system property -DjsonSchemaValidator.FailOnTrailingTokens=true
to the validation, as it is not a default behavior in the Jackson library used in the connector.
-
In Studio, navigate to Run > Run configurations…
-
In the Run Configurations screen, select Mule Applications from the first column.
-
Click the (X)= Arguments tab.
-
In the VM arguments box, add the system property
-DjsonSchemaValidator.FailOnTrailingTokens=true
.
Understand Common Throws
Here is a list of common throw messages and how to interpret them:
-
JSON:INVALID_INPUT_JSON
The input document is not valid JSON.
-
JSON:INVALID_SCHEMA
The supplied schema is invalid.
-
JSON:SCHEMA_NOT_FOUND
The schema could not be found.
-
JSON:SCHEMA_NOT_HONOURED
The input JSON document does not adhere to its schema.
-
JSON:SCHEMA_INPUT_ERROR
The Validate schema operation failed because both the Schema and the SchemaContent fields were used at the same time during the operation's execution. You can only use one of these fields to validate schema XSD content.