I tried to use <on-error ref="test-error-handler"/> to reference the error handling strategy in the Mule Application. I created new test application using Anypoint Studio v7.17 and I encountered that this element causes compilation errors. Has anyone also encountered such a problem and know how to resolve this?
<app.runtime>4.6.2</app.runtime>
<mule.maven.plugin.version>4.2.0</mule.maven.plugin.version>
Error Message:
[ERROR] Failed to execute goal org.mule.tools.maven:mule-maven-plugin:4.2.0:process-classes (default-process-classes) on project common-extend-test: Fail to compile: Cannot invoke "org.mule.runtime.ast.api.ComponentParameterAst.getRawValue()" because the return value of "org.mule.runtime.config.internal.validation.AbstractErrorValidation.getErrorTypeParam(org.mule.runtime.ast.api.ComponentAst)" is null -> [Help 1]
Configuration XML:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:apikit="http://www.mulesoft.org/schema/mule/mule-apikit" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xmlns:http="http://www.mulesoft.org/schema/mule/http" 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/mule-apikit http://www.mulesoft.org/schema/mule/mule-apikit/current/mule-apikit.xsd http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd ">
<flow name="test-raml-main">
<http:listener config-ref="test-raml-httpListenerConfig" path="/api/*">
<http:response statusCode="#vars.httpStatus default 200">
<http:headers>#vars.outboundHeaders default {}</http:headers>
</http:response>
<http:error-response statusCode="#vars.httpStatus default 500">
<http:body>#[payload]</http:body>
<http:headers>#vars.outboundHeaders default {}</http:headers>
</http:error-response>
</http:listener>
<apikit:router config-ref="test-raml-config" />
<error-handler >
<on-error ref="test-error-handler"/>
<on-error-continue enableNotifications="true" logException="true" doc:name="On Error Continue" doc:id="4a2c18e6-d4a4-4659-afb3-0108f1074b3c" >
<logger level="INFO" doc:name="Logger" doc:id="318a7585-7926-4dc6-b76a-5ffe72f392b2" />
</on-error-continue>
</error-handler>
</flow>
<error-handler name="test-error-handler" doc:id="c849264d-d1d4-4a06-b3a0-3b4e3cbf1e35">
<on-error-continue enableNotifications="true" logException="true" doc:name="On Error Continue" doc:id="19e4b41a-b088-4d78-b40a-b6370718e943" type="EXPRESSION">
<logger level="INFO" doc:name="Logger" doc:id="f8acc841-b047-44ac-88fc-cfbc0b33e40f" />
</on-error-continue>
</error-handler>
<flow name="get:\test:test-raml-config">
<logger level="INFO" message="get:\test:test-raml-config" />
</flow>
</mule>
Hi ,
It looks like there is a reference to a common error handler and another 'on error continue' statement present, which is causing the error. Please remove it.
current inside main flow test-raml-main
<on-error ref="test-error-handler"/>
<on-error-continue enableNotifications="true" logException="true" doc:name="On Error Continue" doc:id="4a2c18e6-d4a4-4659-afb3-0108f1074b3c" >
<logger level="INFO" doc:name="Logger" doc:id="318a7585-7926-4dc6-b76a-5ffe72f392b2" />
</on-error-continue>
</error-handler>
instead only have this
<error-handler ref="test-error-handler" />