Sometime we encounter below error when use Custom Java handler inside fault policies.
There are certain points that need to be keep in mind when using Custom Java Handler inside fault policies to handle different type of error.
We usually use Custom Java handler when we handle error for File/FTP adapter or BPEL/Mediator.
Note here that there are different context for file/ftp and BPEL/Mediator. If you use file/ftp context for BPEL/Mediator then you will above error.
In case of file adapter, we get “oracle.integration.platform.faulthandling.recovery.RejectedMsgRecoveryContext” so we have to use this context only.
In case of BPEL, we get “com.collaxa.cube.engine.fp.BPELFaultRecoveryContextImpl” so we have to use this context only.
If I try to use below statement for File adapter then you will get above “can not be cast” error.
BPELFaultRecoveryContextImpl bpelCtx = (BPELFaultRecoveryContextImpl)iFaultRecoveryContext;