Mule Flows:
<jersey:resources doc:name="REST">
<component class="com.test.qb.rest.MapIIFContent"/>
<jersey:exception-mapper class="com.test.qb.exception.IIFExceptionMapper" />
</jersey:resources>
<catch-exception-strategy doc:name="Audit Exception" >
<set-variable variableName="status" value="Failure" doc:name="Status"/>
<flow-ref name="QB:audit" doc:name="audit"/>
<http:response-builder status="500" contentType="application/json" doc:name="Status Code"/>
</catch-exception-strategy>
<logger message=" ===Reached here====" level="INFO" doc:name="Logger"/> <!-- Line 10-->
Java Rest component:
Rest Component:
try{
String s =null;
s.toString();// throw nullpointer exception
} catch (IIFException e) {
return Response.status(500).entity(e.getMessage()).type("Application/json").build();
}
return Response.ok(res).build();
When I run this, it goes to catch block in Java Rest component with error status as 500. But in Mule flows i am expecting flow should reach
'catch-exception-strategy doc:name="Audit Exception" >
block, but it doesn't reach there, instead it reaches to line 10. How do I handle this?
exception-mapperand acatch-exception-strategy: isn't the500response created inMapIIFContent? What happens if you removejersey:exception-mapper: does thecatch-exception-strategyworks? If not, it meansjersey:resourcesexceptions are intercepted by Jersey and never reach Mule. - David Dossot