Wrong catch block is reach

Hi,
I encounter a strange behaviour in exception handling.
My web app can generate pdf files, and download them. If client closes its browser window, a ClientAbortException is thrown (which is expected behaviour, I guess.)
However, I can't catch it correctly. Here is my code:
try {
    // code for generating PDF and downloading it through response output stream.
catch(ClientAbortException caEx) {
    // No specific error handling required
    logger.info("Request aborted by client ["+caEx.getClass()+"] ["+caEx.getMessage()+"]", caEx);
    return "PDF_ERROR";
catch(Exception ex) {
    // A problem occured (TODO notify administrator)
    logger.info("PDF generation failed ["+ex.getClass()+"] ["+ex.getMessage()+"]", ex);
    return "PDF_ERROR";
}The problem is that even in case of ClientAbortException, the exception is caught by the second catch block, and log is:
PDF generation failed [class org.apache.catalina.connector.ClientAbortException] [null]
As you can see, Class name is the same. I tried debugging by adding the following logs in the second catch block:logger.info("instanceof ? "+ (ex instanceof ClientAbortException));
logger.info("class ? "+ (ex.getClass() == ClientAbortException.class));But both logged false.
Could someone explain why it can happen?

1) The fully qualified name of ClientAbortException from your class is indeed org.apache.catalina.connector.ClientAbortException. i.e., you are not importing some other ClientAbortException (that lives in a different package). You may want to print out exact class name by ClientAbortException.class.getName() or change the catch block as
catch (org.apache.catalina.connector.ClientAbortException caEx)
just to be sure.
2) If you get the situation even after verifying the fully qualified class name, then you may want to check whether these are loaded by the same loader or not. You may add the following lines:
logger.info("name equals? "+ (ex.getClass().getName().equals(ClientAbortException.class.getName());
logger.info("same loader ? "+ (ex.getClass().getClassLoader() == ClientAbortException.class.getClassLoader()));
if you get true and false respectively, then the what is seen is correct -- a class uniquely identified by fully qualified class name and the class loader that loaded it.

Similar Messages

  • Use catch block to do something other than handling exception?

    Hello,
    I have always been under the impression that the catch block should only handle the exception thrown by the try block?
    But now I'm reading a class where it's more or less used as an else if. Of course this works well, but I don't like it.
    What is your view of this? A little example:
    FileReader fR = null;
    try{
          fR = new FileReader("file1")
    catch (Exception e){
         //If file1 didn't exist try if file2 exists
         try{
             fR = new FileReader("file2")
         catch (Exception ee){
    }I think it should be rewritten not using this technique?

    Farmor wrote:
    Hello,
    I have always been under the impression that the catch block should only handle the exception thrown by the try block?
    But now I'm reading a class where it's more or less used as an else if. Of course this works well, but I don't like it.
    What is your view of this? A little example:
    FileReader fR = null;
    try{
    fR = new FileReader("file1")
    catch (Exception e){
    //If file1 didn't exist try if file2 exists
    try{
    fR = new FileReader("file2")
    catch (Exception ee){
    }I think it should be rewritten not using this technique?There's nothing really wrong with the code you posted, but I find it ugly to write additional non-error-handling code inside nested try-catches. What happens if you want to extend this logic to 3 or 4 files? If the code could be written to avoid it, as someone else showed, I'd prefer the other way.
    I'd put the file names in an array, and loop over the array until I found one I could open.

  • Trivial Catch block question

    In a test harness I wanted to put some debugging output to System.out and keep one line per thread execution so I could read it more easily.
    I have a try catch block, and in both sections my debugging prints out with System.out.print, so they should appear on the same line. The strange thing I have noticed is that when ever the catch block is entered the code prints on a new line and I dont know why.
    Below is a snippet of code, its pretty simple but illustrates this:
    try {
       System.out.println("starting test - ");
       //at this line the test code runs
       System.out.println("success");  
    } catch(Exception e) {
       System.out.println("fail");
    }The output for a successful test is like:
    starting test success
    And for a fail:
    starting test -
    fail
    I am just curious to know the answer, its like a new line character is output when the print statement is within the try catch block.

    MarksmanKen wrote:
    You want to use System.out.print not System.out.println
    Notice the difference?
    One automatically starts a new line and one just carrys on the current line.Wrong: One automatically ends the current line, while the other one does not!
    A subtle difference, but important:
    This code will print "foo" and "bar" on two separate lines:
    System.out.println("foo");
    System.out.print("bar");This code will print "foobar" on one line:
    System.out.print("foo");
    System.out.println("bar");

  • Handling multiple exceptions with a single catch block

    In the following code:
    try{
    catch (NumberFormatException a) {
    catch (UserDefinedException b) {
    The code for both catch blocks are identical. Is there no way I can combine these into one block?
    For example, could I not do:
    catch ( (NumberFormatException a) || (UserDefinedException b) ){
    or anything similar?
    I did think of:
    try{
    try{
    catch (NumberFormatException a) {
    throw new UserDefinedException("");
    catch (UserDefinedException b){
    but this just seems to be a waste of code. Any ideas?

    I would use the fundamental way to combine identical sections of code--put the code in a new method:
        try {
        catch (NumberFormatException a) {
          myExceptionHandlingMethod(a);
        catch (UserDefinedException b) {
          myExceptionHandlingMethod(b);
      private void myExceptionHandlingMethod(Throwable t) {
      }

  • Can't find class because of try catch block ?!

    Hello,
    I'm using the JNI to use a java library from my c++ code.
    JNI can't find the "Comverse10" class below, but when i put the try catch block in createMessage in comment, FindClass succeeds ?!
    Unfortunatly i need the code inside the try block ;-)
    I tried a few things, but none of them worked:
    - let createMessage throw the exception (public void createMessage throws ElementAlreadyExistsException ), so there isn't a try catch block in createMessage => result: the same
    - make a "wrapper" class Comverse that has a Comverse10 object as attribute and just calls the corresponding Comverse10.function. Result: Comvers could be found, but not constructed (NewObject failed).
    Can someone tell me what is going on ?!
    Thank you,
    Pieter.
    //Comverse10 class
    public class Comverse10 {
    MultimediaMessage message;
    /** Creates a new instance of Comverse10 */
    public Comverse10() {
    public void createMessage() {
    TextMediaElement text1 = new TextMediaElement("Pieter");
    text1.setColor(Color.blue);
    SimpleSlide slide1 = new SimpleSlide();
    //if i put this try catch block in comment, it works ?!
    try{
    slide1.add(text1);
    catch(com.comverse.mms.mmspade.api.ElementAlreadyExistsException e){}
    MessageContent content = new MessageContent();
    content.addSlide(slide1);
    this.message = new MultimediaMessage();
    message.setContent(content);
    message.setSubject("Mijn subjectje");
    for those of you who are intersted: here's my C++ code:
    //creation of JVM
    HRESULT Java::CreateJavaVMdll()
         HRESULT HRv = S_OK;
    char classpath[1024];
         jint res;
         if(blog)     this->oDebugLog->Printf("CreateJavaVMdll()");
         strcpy(classpath,"-Djava.class.path="); /*This tells jvm that it is getting the class path*/
         strcat(classpath,getenv("PATH"));
         strcat(classpath,";D:\\Projects\\RingRing\\MMSComposer;C:\\Progra~1\\j2sdk1~1.1_0\\lib");     //;C:\\Comverse\\MMS_SDK\\SDK\\lib\\mail.jar;C:\\Comverse\\MMS_SDK\\SDK\\lib\\activation.jar;C:\\Comverse\\MMS_SDK\\SDK\\lib\\mmspade.jar
         //------Set Options for virtual machine
         options[0].optionString = "-Djava.compiler=NONE"; //JIT compiler
         options[1].optionString = classpath;                                        //CLASSPATH
         //------Set argument structure components
         vm_args.options = options;
         vm_args.nOptions = 2;
         vm_args.ignoreUnrecognized = JNI_TRUE;
         vm_args.version = JNI_VERSION_1_4;
         /* Win32 version */
         HINSTANCE hVM = LoadLibrary("C:\\Program Files\\j2sdk1.4.1_01\\jre\\bin\\client\\jvm.dll");
         if (hVM == NULL){
              if(blog) oDebugLog->Printf("Can't load jvm.dll");
              return E_FAIL;
         if(blog) oDebugLog->Printf("jvm.dll loaded\n");
         LPFNDLLFUNC1 func = (LPFNDLLFUNC1)GetProcAddress(hVM, "JNI_CreateJavaVM");
         if(!func){
              if(blog)     oDebugLog->Printf("Can't get ProcAddress of JNI_CreateJavaVM");
              FreeLibrary(hVM);     hVM = NULL;
              return E_FAIL;
         if(blog)     oDebugLog->Printf("ProcAddress found");
         res = func(&jvm,(void**)&env,&vm_args);
         if (res < 0) {
    if(blog)     oDebugLog->Printf("Can't create JVM with JNI_CreateJavaVM %d\n",res);
    return E_FAIL;
         if(blog)     oDebugLog->Printf("JVM created");
         return HRv;
    //finding Comverse10 class:
    HRESULT CALLAS MMSComposer::InitializeJNI(void)
         HRESULT HRv=E_FAIL;
         DWORD T=0;
         try
              if(blog)     oDebugLog->Printf("\nInitializeJNI()");
              bJVM = FALSE;
              jni = new Java(oDebugLog);
              if(jni->CreateJavaVMdll()!=S_OK){
                   if(blog)     oDebugLog->Printf("CreateJavaVMdll() failed");     
                   return HRv;
              jclass jcls = jni->env->FindClass("Comverse10");
              if (jcls == 0) {
    if(blog)     oDebugLog->Printf("Can't find Comverse10 class");
                   jclass jcls2 = jni->env->FindClass("test");
                   if (jcls2 == 0) {
                        if(blog)     oDebugLog->Printf("Can't find test class");
                        return HRv;
                   if(blog)     oDebugLog->Printf("test class found %08x",jcls2);
    return HRv;
              if(blog)     oDebugLog->Printf("Comverse10 class found %08x",jcls);
              jmethodID mid = jni->env->GetMethodID(jcls , "<init>", "()V");
              if (mid == 0) {
                   if(blog)     oDebugLog->Printf("Can't find Comverse10() constructor");
    return HRv;
              if(blog)     oDebugLog->Printf("Comverse10() constructor found");
              jobject jobj = jni->env->NewObject(jcls,mid);
              if(jobj==0)
                   if(blog)     oDebugLog->Printf("Can't construct a Comverse10 object");
    return HRv;
              if(blog)     oDebugLog->Printf("Comverse10 object constucted");
              //Create Global reference, so java garbage collector won't delete it
              jni->jobj_comv = jni->env->NewGlobalRef(jobj);
              if(jni->jobj_comv==0)
                   if(blog)     oDebugLog->Printf("Can't create global reference to Comverse10 object");
    return HRv;
              if(blog)     oDebugLog->Printf("global reference to Comverse10 object %08x created",jni->jobj_comv);
              bJVM=TRUE;
              HRv=S_OK;
         }     catch( IDB * bgError ) { throw bgError->ErrorTrace("InitializeJNI::~InitializeJNI",HRv, 0, T); }
              catch(...) { throw IDB::NewErrorTrace("InitializeJNI::~InitializeJNI",HRv, 0, T ); }
              return HRv;

    >
    I would guess that the real problem is that that the
    exception you are catching is not in the class path
    that you are defining.Thanks jschell, that was indeed the case.
    I don't have the docs, but I would guess that
    FindClass() only returns null if an exception is
    thrown. And you are not checking for the exception.
    Which would tell you the problem.Ok, i'll remember that. But what with exceptions thrown in my java code, the documents say
    // jthrowable ExceptionOccurred(JNIEnv *env);
    // Determines if an exception is being thrown. The exception stays being thrown until either the native code calls ExceptionClear(), or the Java code handles the exception
    so, what if the java code throws an exception and catches it, will i be able to see that in my c++ code with ExceptionOccurred ?
    or
    should the java method be declared to throw the exception (and not catch it inside the method)
    Again, thank you for your help, it's greatly appreciated !

  • Exception Handling In BPEL  By using Catch Blocks or Fault Policies Or Both

    I have a confusion regarding
    Exception handling :
    When Should i go for 1)Catch Block (Remote , or binding ) in bpel for exception handling .
    2)Fault Policy , Fault binding.xml
    Currently iam using catch blocks , but even fault policy is good , but can i use both...
    Currently in My bpel ,when any error occurs i have to send a error notification by Email .
    Currently i have exposed the email service which shuts emails and write a file with errored Message.
    Hence if any error i will catch i in a parent BPEL, i will just invoke the above email, service .
    So anybody can help me by giving the suggestion how to go for the best approach
    Edited by: anantwag on Mar 23, 2011 6:31 AM

    Currently in My bpel ,when any error occurs i have to send a error notification by Email .
    Currently i have exposed the email service which shuts emails and write a file with errored Message.Seeing your use case I will suggest you to use fault handling framework (fault policy). Fault handling framework should be used where you need generic error handling framework which handles all the faults occured in any composite component. Generally BPEL catch block should be used to propagate error info/fault back to the client/to fault handling framework or to consume an error
    Regards,
    Anuj

  • How to get the returned error messages in the Try/Catch block in DS 3.0?

    A customer sent me the following questions when he tried to implement custom error handling in DS 3.0. I could only find the function "smtp_to" can return the last few lines of trace or error log file but this is not what he wants. Does anyone know the answers? Thanks!
    I am trying to implement the Try/Catch for error handling, but I have
    hard time to get the return the msg from DI, so I can write it to out
    custom log table.
    Can you tell me or point me to sample code that can do this, also, can
    you tell me which tables capture these info if I want to query it from
    DI system tables

    Hi Larry,
    In Data Services XI 3.1 (GAd yesterday) we made several enhancements for our Try/Catch blocks. One of them is the additional of functions to get details on the error that was catched :
    - error_message() Returns the error message of the caught exception
    - error_number() Returns the error number of the caught exception
    - error_timestamp() Returns the timestamp of the caught exception.
    - error_context() Returns the context of the caught exception. For example, "|Session Datapreview_job|Dataflow debug_DataFlow|Transform Debug"
    In previous versions, the only thing you could do was in the mail_to function specify the number of lines you want to include from the error_log, which would send the error_log details in the body of the mail.
    Thanks,
    Ben.

  • Return in finally block hides exception in catch block

    Hi,
    if the line marked with "!!!" is commented out, the re-thrown exception is not seen by the caller (because of the return in the finally block). If the line is commented in, it works as I would expect. Is this is bug or a feature? I assume the return removes the call to troubleMaker() from the call stack - including the associated exception...
    Christian Treber
    [email protected]
    public class ExceptionDemo extends TestCase
    public void testException()
    String lResult = "[not set]";
    try
    lResult = troubleMaker();
    System.out.println("No exception from troubleMaker()");
    } catch(Exception e)
    System.out.println("Caught an exception from troubleMaker(): " + e);
    System.out.println("Result: " + lResult);
    public String troubleMaker()
    boolean lErrorP = false;
    try
    if(6 > 5)
    throw new RuntimeException("Initial exception");
    return "normal";
    } catch (RuntimeException e)
    System.out.println("Caught runtime exception " + e);
    lErrorP = true;
    throw new RuntimeException("Exception within catch");
    } finally
    System.out.println("Finally! Error: " + lErrorP);
    if(!lErrorP)
    return "finally";

    This is specified in the Java Language Specification, section 14.19.2 .
    -- quote
    If execution of the try block completes abruptly because of a throw of a value V, then there is a choice:
    * If the run-time type of V is assignable to the parameter of any catch clause of the try statement, then the first (leftmost) such catch clause is selected. The value V is assigned to the parameter of the selected catch clause, and the Block of that catch clause is executed. Then there is a choice:
    o If the catch block completes normally, then the finally block is executed. Then there is a choice:
    + If the finally block completes abruptly for any reason, then the try statement completes abruptly for the same reason.
    -- end quote
    "completing abruptly" (in this instance) means a throw or a return, as specified in section 14.1
    Ok? It's not a bug, it's the defined behaviour of the language. And when you think about it, this behaviour gives you the option to do what you want in your finally block.

  • Is it possible to get back to the Try block from a Catch block?

    I would like to perform validations on a config file. To do so, I have a method which will throw a MissingConfigException or an InvalidConfigException if something is missing or if something doesn't match a regex pattern. Although I have to do that with many different configs and I would like to go through all of them so that my error message will report all missing / incorrect configs at once instead of 1 at a time. Thus, I wanted to know if there would be any way I could do something like:
    try {
         config.validate("ServerPort","\\d+");
         config.validate("MaxClients","\\d+");
    } catch(MissingConfigException e) {
    } catch(InvalidConfigException e) {
    and have the catch block executed before going through the try block from where the exception was thrown.
    Thanks in advance!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    No, you can't jump back into the try. You can put your try/catch inside a loop though, so that if one fails, it will loop around and start a new try for the next one. Define a class that holds all the data you need to pass to validate, and make an array or List of those objects. Change or add a validate signature that takes this object, or just extract the strings from each one when you call validate.
    ThingToValidate[] val = new ThingToValidate[] { new ThingToValidate("ServerPort", "\\d+"),
        new ThingToValidate("MaxClients", "\\d+"),
    for (int ix = 0; ix < val.length; ix++) {
        try {
            config.validate(val[ix]);
            // OR
            config.validate(val[ix].getThingy, val[ix].getOtherThingy[]);
        catch (....) {
            // logger.warn("failed...");

  • TRY..catch block in a loop.

    Hi Epxerts,
    Can i use loop endloop for the following TRY..CATCH block as i need to send multiple records
    LOOP.
    TRY.
      Assign row
        it_prxstruc-MT_table_EXTRACT-record-row = wa_area1. --> one record of
        CALL METHOD prxy->execute_asynchronous
          EXPORTING
            output = it_prxstruc --> 1 record.
        COMMIT WORK
      CATCH cx_ai_system_fault .
        DATA fault TYPE REF TO cx_ai_system_fault .
        CREATE OBJECT fault.
        WRITE :/ fault->errortext.
    ENDTRY.
    ENDLOOP.
    Please suggest accordingly.
    Thanks
    Dany

    Try-Endtry specifies the territory of exception that catch is going to handle. Do it this way..
    TRY.
    LOOP.
    Assign row
    it_prxstruc-MT_table_EXTRACT-record-row = wa_area1. --> one record of
    CALL METHOD prxy->execute_asynchronous
    EXPORTING
    output = it_prxstruc --> 1 record.
    COMMIT WORK
    ENDLOOP.
    CATCH cx_ai_system_fault .
    DATA fault TYPE REF TO cx_ai_system_fault .
    CREATE OBJECT fault.
    WRITE :/ fault->errortext.
    ENDTRY.
    G@urav.

  • RAISERROR with Try/Catch does not exit after exception in catch block

    I am trying to propogate an error from within my proc out to the caller.
    In the attached example I have 2 sets of try catch blocks.
    I raiserror in the first
    catch the error and then raiserror again. (I expect to exit)
    I do not expect :
    to get to print 'post test'
    to get to second try block.
    but this does not exit, instead the code flows as per 2 runs.
    I do not understand the reason for the flows, as it seems counterintuitive to be raising an error but then still print following exceptions. I cannot seem to find any references that explains this behaviour.
     running tests together results
    print '-------------------------------------------------------'
    print 'test 15'
    exec test_raiseerror 15
    print '-------------------------------------------------------'
    print 'test 16'
    exec test_raiseerror 16
    print '-------------------------------------------------------'
    print 'test 17'
    exec test_raiseerror 17
    print '-------------------------------------------------------'
    print 'test 18'
    exec test_raiseerror 18
    print '-------------------------------------------------------'
    'RESULTS'
    test 15
    error number provided: 15
    Msg 50000, Level 15, State 1, Procedure test_raiseerror, Line 21
    name hello 15
    post test
    15
    Msg 50000, Level 15, State 1, Procedure test_raiseerror, Line 37
    name hello 2 15
    post test2
    test 16
    error number provided: 16
    Msg 50000, Level 16, State 1, Procedure test_raiseerror, Line 21
    name hello 16
    post test
    16
    Msg 50000, Level 16, State 1, Procedure test_raiseerror, Line 37
    name hello 2 16
    post test2
    test 17
    error number provided: 17
    post test
    17
    post test2
    test 18
    error number provided: 18
    post test
    18
    post test2
    Msg 50000, Level 17, State 1, Procedure test_raiseerror, Line 21
    name hello 17
    Msg 50000, Level 17, State 1, Procedure test_raiseerror, Line 37
    name hello 2 17
    Msg 50000, Level 18, State 1, Procedure test_raiseerror, Line 21
    name hello 18
    Msg 50000, Level 18, State 1, Procedure test_raiseerror, Line 37
    name hello 2 18
    run tests seperately
    exec test_raiseerror 15
    error number provided: 15
    RESULTS 15
    Msg 50000, Level 15, State 1, Procedure test_raiseerror, Line 21
    name hello 15
    post test
    15
    Msg 50000, Level 15, State 1, Procedure test_raiseerror, Line 37
    name hello 2 15
    post test2
    exec test_raiseerror 16
    RESULTS 16
    error number provided: 16
    Msg 50000, Level 16, State 1, Procedure test_raiseerror, Line 21
    name hello 16
    post test
    16
    Msg 50000, Level 16, State 1, Procedure test_raiseerror, Line 37
    name hello 2 16
    post test2
    exec test_raiseerror 17
    RESULTS 17
    error number provided: 17
    post test
    17
    post test2
    Msg 50000, Level 17, State 1, Procedure test_raiseerror, Line 21
    name hello 17
    Msg 50000, Level 17, State 1, Procedure test_raiseerror, Line 37
    name hello 2 17
    exec test_raiseerror 18
    RESULTS 18
    error number provided: 18
    post test
    18
    post test2
    Msg 50000, Level 18, State 1, Procedure test_raiseerror, Line 21
    name hello 18
    Msg 50000, Level 18, State 1, Procedure test_raiseerror, Line 37
    name hello 2 18
     CODEBLOCK:
    if object_id('test_raiseerror','P') is not null
    drop proc test_raiseerror
    go
    create proc test_raiseerror(@id as int) as
    begin
    begin try
    declare @name varchar(20)
    select @name = 'hello'
    raiserror('name %s %d',@id,1,@name,@id)
    print 'next'
    end try
    begin catch
    declare @errormessage nvarchar(4000)
    declare @errornum int
    select @errormessage = error_message()
    , @errornum = error_severity()
    print 'error number provided: ' + convert(varchar(2),@errornum)
    raiserror(@errormessage, @errornum,1)
    print 'post test'
    end catch
    begin try
    select @name = 'hello 2'
    raiserror('name %s %d', @id,1,@name, @id)
    end try
    begin catch
    select @errormessage = error_message()
    , @errornum = error_severity()
    print @errornum
    raiserror(@errormessage, @errornum,1)
    print 'post test2'
    end catch
    end
    go
    sqlserver 2008 & 2008 R2

    There is a Connect that describes a similiar complaint.  But basically a raiserror inside a catch block does not terminate the procedure, it will continue with any additional code in the CATCH and FINALLY unless it hits a return statement.
    http://connect.microsoft.com/SQLServer/feedback/details/275308/have-raiserror-work-with-xact-abort

  • Can error handling framework use fault policies and BPEL catch blocks

    As part of an integrated customer solution that makes substantial use of SOA Suite (including OSB, BPEL, Mediator, etc) we are in the process of designing an “Error Hospital” subsystem to expose a web service API specifically for BPEL services and/or the OSB layer to call whenever they encounter an exception which they cannot handle so that the appropriate user is notified of the error (via email) and the error is recorded (in an appropriate common fault format, with error codes elaborated into more meaningful descriptions, etc) within OEM, immediately prior to returning the exception to the caller.
    The problem we have experienced in our design is as follows:
    •     We have an error handling service to be called, inside the BPEL catch blocks, when an error occurs to notify the appropriate user, via email, that an error has occurred;
    •     We also use the error handling XML fault-policies so that we can recover from an error using OEM (via human intervention);
    •     The error service needs to be called before the process is suspended (waiting for human intervention) so the email notification and error message formatting occurs BEFORE the recovery action. Unfortunately the fault policies trigger BEFORE the error handler is able to transform the error into the appropriate format and notify the user so the error recorded is not the reformatted one and the user is never notified.
    The key question is how can a BPEL, upon catching an exception, invoke the error handling service and AFTER that send the error to OEM (and have the process suspended).
    It seems the two mechanisms "cannot play nicely together"

    As part of an integrated customer solution that makes substantial use of SOA Suite (including OSB, BPEL, Mediator, etc) we are in the process of designing an “Error Hospital” subsystem to expose a web service API specifically for BPEL services and/or the OSB layer to call whenever they encounter an exception which they cannot handle so that the appropriate user is notified of the error (via email) and the error is recorded (in an appropriate common fault format, with error codes elaborated into more meaningful descriptions, etc) within OEM, immediately prior to returning the exception to the caller.
    The problem we have experienced in our design is as follows:
    •     We have an error handling service to be called, inside the BPEL catch blocks, when an error occurs to notify the appropriate user, via email, that an error has occurred;
    •     We also use the error handling XML fault-policies so that we can recover from an error using OEM (via human intervention);
    •     The error service needs to be called before the process is suspended (waiting for human intervention) so the email notification and error message formatting occurs BEFORE the recovery action. Unfortunately the fault policies trigger BEFORE the error handler is able to transform the error into the appropriate format and notify the user so the error recorded is not the reformatted one and the user is never notified.
    The key question is how can a BPEL, upon catching an exception, invoke the error handling service and AFTER that send the error to OEM (and have the process suspended).
    It seems the two mechanisms "cannot play nicely together"

  • Fault Handling in BPEL - Continue after Catch Block

    Hi,
    I have a catch block in my BPEL process.
    On exception, the catch block catches the error and terminates the BPEL Process.
    Is it possible to loop back the flow after the catch sequence?
    Thanks,
    Venkat

    Hi,
    Thanks for your reply
    Sorry, I was not clear with my question.
    I have a infinite loop in my process. Inside the loop I have an invoke operation(Invokes another BPEL process) and a wait operation. If any exception occurs, my BPEL process terminates. However, I wanted my BPEL process to just continue in the loop.
    I solved the issue with the help of this How to handle fault when BPEL process is polling a FTP server which is down
    i.e, using the Scope activity. Place my invoke operation inside a scope and put a catchAll block only for that scope. Its working fine
    Thanks,
    Venkat

  • Return statement in catch block !

    Hello Java Gurus,
    The code is not compiling when i remove return from the catch block
    i dont really understand the essence of return statement in catch block
    any help is greatly appreciated !
    Thanks in advance !
    import java.io.*;
    public class fileinputstream  {
       public static void main(String arg[]) {
            FileInputStream fin ;
            FileOutputStream fout;
           try  {
                 fin =new     FileInputStream("input_file.txt");
                 int bytes_av = fin.available();
                 System.out.println("bytes available the input file "+bytes_av);
           catch(FileNotFoundException e)
               System.out.println("The input file is not present");
               return;
           catch(IOException e)
               System.out.println("error while giving bytes available the input file");
               return;
           try
                     fout =new FileOutputStream("output_file.txt");
           catch(FileNotFoundException e)
               System.out.println("The output file cannot be created");
               return;
           int data=0;
           try  {
               data =(int)fin.read();
           catch(IOException e) {
               System.out.println("Exception while reading from file");
            while(-1!=data)      {
                       try
                       fout.write(data);
                       catch(IOException e)
                           System.out.println("Error while writing to file");
                       try
                           data =(int)fin.read();
                       catch(IOException e)
                           System.out.println("Exception while reading from file");
            try  {
                   fin.close();
                   fout.close();
            catch(IOException e)  {
               System.out.println("Error while closing files");
    }

    You do understand what "return" means, don't you? It
    exits the method, main() in this case.
    So the return statements in the catch blocks end the
    program. If you remove the return statements, the
    program will continue with the code after the catch
    blocks. It needs the variables "fout" and "fin"
    there, and these must be initialised.
    If there are no return statements in the catch
    blocks, the variables "fin" and "fout" will be not
    initialized when you get to the code that uses them,
    and that's an error. The java compiler is telling you
    that you must always initialise the variables (you
    can set them to "null", for example).Great explanation !!!
    Thanks !

  • Return statement inside a catch block???

    If you put a return statement inside of a catch block, what statements will be executed next? I.e., what happens to the flow of control?

    If you put a return statement inside of a catchblock, what statements will be executed next? I.e.,
    what
    happens to the flow of control?If you write a short testing sample, compile it and
    run it, what do you get as a result ?
    Eek! That actually involves effort! Are you kidding?Kidding ? Me ?
    I'd better waste my time writing programs for lazy OPs !
    ;)

Maybe you are looking for

  • X2-01 : Blank entry in my call log!!!

    I updated my X2-01 to v08.63 yesterday.It had no other problems.But now there is a blank entry in the call log and i cant delete it.I've tried the backup and restore solution for blank msg bug,but it didnot work. Somebody please help me.....

  • Third party setup and config softs, utils and tools.

    Hello everyone, I found, as expected, a lot of If-Then-ElseIfs in setting up servers, sure there's the worksheets, hords of PDF and Docs, video trainings, but what's more interactive? Example: For FileMaker Pro, there are third party softwares like W

  • I Need Information about  Open Source Java Client/Server Instant Messaging

    I need your valuable help and collaboration with the following issue: I need to know where can find a robust Open Source Java Instant Messaging Client/Server Application. I thank in advance for their valuable time. And for the attention and the colla

  • Re-publish site using 3rd party FTP Client-Changes are not visible

    I uploaded my Iweb site to the server using FileZilla. When I make changes in I-web and republish, the changes are not visible. I even tested it out by deleting the site folder and re-uploading everything after I re-published the site in IWeb...but t

  • Uploading Opening Balances for GL, Vendor & Customer Accounts

    Hi Gurus, We are currently on the verge of going live for a client and we need to upload the opening balances. I am really not sure how to uploaded the opening balances... Can anyone guide me in process/procedure to be followed... Request you to prov