Reputation: 13
I am getting an error message when trying to add a Spring component to a Mule Flow. This should be a common user-case, but I wasn't able to find the right documentation or examples. Thanks in advance.
The follow was the original configuration and works fine:
<flow name="ApplicationEndpoint">
<inbound-endpoint address="server:port/JSONAPI/"/>
<jersey:resources>
<component>
<spring-object bean="myJerseyService"/>
</component>
</jersey:resources>
<catch-exception-strategy doc:name="Catch Exception Strategy">
<flow-ref name="ErrorHandling" doc:name="Flow Reference"/>
</catch-exception-strategy>
</flow>
I simply want to add a new component to do some post-processing. When I try this, it doesn't work:
<flow name="ApplicationEndpoint">
<inbound-endpoint address="server:port/JSONAPI/"/>
<jersey:resources>
<component>
<spring-object bean="myJerseyService"/>
</component>
</jersey:resources>
<component>
<spring-object bean="postProcessor"/>
<component>
<catch-exception-strategy doc:name="Catch Exception Strategy">
<flow-ref name="ErrorHandling" doc:name="Flow Reference"/>
</catch-exception-strategy>
</flow>
Where "postProcessor" maps elsewhere in the config as a spring bean.
The error message I get is:
org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'component'. One of '{"http://www.mulesoft.org/schema/mule/core":abstract-lifecycle-adapter-factory, "http://www.mulesoft.org/schema/mule/core":binding}' is expected.
Upvotes: 0
Views: 363
Reputation: 8321
The above error clearly shows that the tag <component>
is not closed..
for example, it should be in following format :-
<component>
<spring-object bean="postProcessor"/>
</component>
where you need to end the tag like the following :- </component>
One more thing ... I tried to run your code, but due to server:port/JSONAPI/
configured in your inbound-endpoint
address it gives a error saying the xml is malformed
So I modified your code as following and it ran successfully :-
<flow name="ApplicationEndpoint">
<inbound-endpoint address="http://localhost:8189/JSONAPI"/>
<jersey:resources>
<component>
<spring-object bean="myJerseyService"/>
</component>
</jersey:resources>
<component>
<spring-object bean="postProcessor"/>
</component>
<catch-exception-strategy doc:name="Catch Exception Strategy">
<flow-ref name="ErrorHandling" doc:name="Flow Reference"/>
</catch-exception-strategy>
</flow>
So, you can now use it and modify as per your requirement
Upvotes: 1