Problem invoking "catch-all" fault policy when custom fault messages thrown
734466Sep 30 2010 — edited Jun 15 2012After quite a bit of reading, I am still confused about fault handling. Here, we perform a lot of asynchronous calls to composites/BPEL processes and I generally throw a custom fault. I don't catch the fault in the BPEL process because I want it to percolate up to the fault policy, where I have a generic catch-all faults. Like so:
faultPolicies xmlns="http://schemas.oracle.com/bpel/faultpolicy">
<faultPolicy version="2.0.1"
id="PersonSFFaults"
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.oracle.com/bpel/faultpolicy"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Conditions>
<!-- fault handler for all faults -->
<faultName>
<condition>
<action ref="java-fault-handler"/>
</condition>
</faultName>
</Conditions>
<Actions>
<Action id="java-fault-handler">
<javaAction className="edu.villanova.soa.handlers.FaultNotificationHandler"
defaultAction="ora-human-intervention" propertySet="faultNotificationProps">
<returnValue value="OK" ref="ora-human-intervention"/>
</javaAction>
</Action>
I created custom faults to throw. I have a PersonLoadFault that will be thrown under the right circumstances and the java FaultNotificationHandler should send me an email. But instead, the fault policy fails to work as I would expect. Rather the logging suggests that it can't find the fault policy (which is part of the composite). Here's the sort of msg I get:
[2010-09-30T13:04:48.578-04:00] [soa_server1] [ERROR] [] [oracle.soa.bpel.engine] [tid: orabpel.invoke.pool-4.thread-5] [userId: <anonymous>] [ecid: 0000IhZaaj9Fw000jzwkno1CaE4900015T,0:2:14:100003093] [APP: soa-infra] [composite_name: PersonSF] [component_name: PersonLoadProcess] [component_instance_id: 215862] [dcid: 11d1def534ea1be0:-2df91098:12b3530eb94:-7ffd-0000000000000014] <CubeEngine::handleWorkItem> This exception occurred because the fault thrown in the BPEL flow was not handled by any fault handlers and reached the top-level scope. Root cause : com.oracle.bpel.client.BPELFault: faultName: {{http://xmlns.oracle.com/VUAdvanceSF_jws/PersonSF/PersonLoadProcess}PersonLoadFault}[[
messageType: {{http://xmlns.oracle.com/VUAdvanceSF_jws/PersonSF/PersonLoadProcess}PersonLoadProcessFault}
parts: {{
fault=<PersonLoadProcessFault>
<faultCode>BANNER_INFO_MISMATCH</faultCode>
<faultMessage>Could find no Organization Id corresponding to the pidm provided.</faultMessage>
</PersonLoadProcessFault>}
]]
[2010-09-30T13:04:48.634-04:00] [soa_server1] [ERROR] [] [oracle.soa.bpel.engine.dispatch] [tid: orabpel.invoke.pool-4.thread-5] [userId: <anonymous>] [ecid: 0000IhZaaj9Fw000jzwkno1CaE4900015T,0:2:14:100003093] [APP: soa-infra] [dcid: 11d1def534ea1be0:-2df91098:12b3530eb94:-7ffd-0000000000000014] <DispatchHelper::handleMessage> failed to handle message[[
ORABPEL-02055
Fault not handled.
failure to handle a fault thrown from a scope, by any blocks in the scope chain.
This exception occurred because the fault thrown in the BPEL flow was not handled by any fault handlers and reached the top-level scope.
A top-level fault handler should be added to the flow to handle faults not caught from within the flow.
Can anyone explain to me why the fault policy doesn't fire? The binding in the composite is:
<?xml version="1.0" encoding="UTF-8" ?>
<faultPolicyBindings version="2.0.1"
xmlns="http://schemas.oracle.com/bpel/faultpolicy"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<composite faultPolicy="PersonSFFaults"/>
</faultPolicyBindings>
So I would expect the fault policy to be found but the stmt "A top-level fault handler should be added...." suggests that it is not. Is there a problem handling custom fault msgs via the fault policy? Or am I victim of a basic misunderstanding of how fault handling should work? I'd appreciate any advice.
- Cris