Customised Exception handling class.....

Hello Friends,
I am working on a project for which I need to create my own exception handling class.
The reason I need this class is to catch any exceptions and get a customised error message
according to each exception and then be able to display those messages on web page.
some examples of the exception I want to catch and display appropriate message are..
1. a duplicate reord in db
2. wrong data type (this will deal with ints,doubles and strings data types)
3. date type validation ( to make sure its date object instead of a string)
and there are several more messages but if can get some help or idea from any one to design a class for the above errors I might be able to manage other errors as well.
greatly appreciate any respnses.

First off, you can extend Exception:
public class MyException extends Exception {
}You can put some custom messages into the class:
public class MyException extends Exception {
  public static final String DUPLICATE_RECORD = "Duplicate record in db",
                       WRONG_DATA_TYPE = "Wrong data type",
                       VALIDATION_ERROR = "Invalid data type";
}Then, have your constructors, which take a String as an argument, so they can get your 'presets' or a custom message:
public class MyException extends Exception {
  public static final String DUPLICATE_RECORD = "Duplicate record in db",
                       WRONG_DATA_TYPE = "Wrong data type",
                       VALIDATION_ERROR = "Invalid data type";
  public MyException(String message) {
    super(message);
}You could also have a series of exception classes: DuplicateRecordException, WrongDataTypeException, ValidationException, etc. Hope that helps.
m

Similar Messages

  • Exception handling class

    hi i have to going to handle error page so for that i want to create
    one helper class which is identify all the exception so this utility class i have to use in my application for handling error page so please if anybody know about how to make this helper class please help me thanks

    First off, you can extend Exception:
    public class MyException extends Exception {
    }You can put some custom messages into the class:
    public class MyException extends Exception {
      public static final String DUPLICATE_RECORD = "Duplicate record in db",
                           WRONG_DATA_TYPE = "Wrong data type",
                           VALIDATION_ERROR = "Invalid data type";
    }Then, have your constructors, which take a String as an argument, so they can get your 'presets' or a custom message:
    public class MyException extends Exception {
      public static final String DUPLICATE_RECORD = "Duplicate record in db",
                           WRONG_DATA_TYPE = "Wrong data type",
                           VALIDATION_ERROR = "Invalid data type";
      public MyException(String message) {
        super(message);
    }You could also have a series of exception classes: DuplicateRecordException, WrongDataTypeException, ValidationException, etc. Hope that helps.
    m

  • Standard Customised Exception Handler Creation

    Hi,
    SOA SUITE 11g 11.1.1.4
    Actually i need some good Documentation on Customized Error Handling ,Documentation on the same.
    I want to design a Error Handler process which can handle any type of faults loosely coupled to the main process, takes care of notification as well.
    Will there be some standardized way of , the architectural approach which i should follow and it should be already proven.
    2) i want to know how to create a Canonical shema, , is there any standardized way also for the same as per oagis standards.
    I will be really thankful if any architect will provide me the solution for the same.
    Thanks,
    Anant
    Edited by: anantwag on Feb 25, 2011 7:39 AM

    Hi !
    Just few ideas ..
    Your ERRORS_TABLE is probably the only way .. You can in fact load all the errors in memory but if you have an serious application .. errors should be in table
    You can include in the error table some key like language , which is meant like the languge of error msg if you are dealing with multilanguage app
    Somewhere in app ( in some package GLOBAL for example ) you should define memory structure - cache and when the error is first time call you can write it into cache and then when the error raise again you can get errm from your cache. For this option you should consider few things .. maybe your error_table will always resides in "system" cache .. if you have web app your cache will probably be almost always empty .. depends on app ,you should check what is the performance effect ..
    You should create an UI over error table
    For handling oracle errors .. if you want to diferentiate oracle-errors from user defined .. for user defined exception code could only be -20000 .. -20999
    O and of course for key in your table use code of course and not errm
    T
    Edited by: ttt on 20.3.2010 15:19
    Well i'm thinking about that table .. if you expect that you will change errmsgs often , or in fact ..add from time to time translation to your errm than
    yes as you have present your problem .. you should have table ... else of course there is a possibility that you hardcode everything in a package provided for this purpose ..

  • Exception Handling for many bean objects of a container class in a JSP page

    Hello,
    I have on container bean class. In this container class, there are several others class objects and the getter methods to get these objects out to the JSP pages.
    I have one JSP page which will use different objects in the container class object through the getter methods of the container class.
    My question is how to implement the exception handler for all the objects in the container so that the JSP page can handle all exceptions if occurrs in any object in the container?
    Please give me some suggestions. Thanks
    Tu

    Thanks for your reply.
    Since the container is the accessor class, I have no other super class for this container class, I think I will try the try catch block in the getter methods.

  • Class based exception handling

    Hi everyone....
    I am new to object oriented abap.
    I would like to know more about exception handling using classes.
    please provide some good material or links on the topic?
    Points will be rewarded.......

    hi,
    Download the PDF from here.
    http://www.esnips.com/doc/6d16a298-9227-4d32-acf1-e91164c89daf/3-ABAP-Objects(P283)
    Follow this link too for tutorials.
    http://www.****************/Tutorials/OOPS/MainPage.htm
    Hope this helps, Do reward.
    Edited by: Runal Singh on Mar 14, 2008 3:28 PM

  • Exception Handling Standards -The exception Exception should never been thrown. Always Subclass Exception and throw the subclassed Classes.

    In the current project my exception handling implementation is as follows :
    Exception Handling Layer wise :
    DL layer :
    catch (Exception ex)
    bool rethrow = ExceptionPolicy.HandleException(ex, "Ui Policy");
    if (rethrow)
    throw;
    BL Layer
    catch (Exception ex)
    bool rethrow = ExceptionPolicy.HandleException(ex, "Ui Policy");
    if (rethrow)
    throw;
    UI Layer
    catch (Exception ex)
    bool rethrow = ExceptionPolicy.HandleException(ex, "Ui Policy");
    if (rethrow)
    Response.Redirect("ErrorPage.aspx", false);
    We have a tool to check the standards. And tool output is as follows :
    The exception Exception should never been thrown. Always Subclass Exception and throw the subclassed Classes.
    I need suggestions on how to implement the same according to standards.

    Your tool is wrong if it says to never throw Exception.  This was a common recommendation back in the .NET v1 days but has long since been thrown out.  It is perfectly fine to use Exception when you have a general exception that provides no information
    that an application can use to make an informed opinion.
    The general rules of exception throwing is to throw the most specific exception that makes sense. If there is no specific exception that applies and it would be useful for the caller to handle the exception differently than other exceptions then creating
    a custom exception type is warranted.  Otherwise throwing Exception is reasonable. As an example you might have an application that pulls back product data given an ID. There is no built in exception that says the ID is invalid. However an invalid ID
    is something that an application may want to handle differently than, say, an exception about the product being discontinued.  Therefore it might make sense to create an ItemNotFoundException exception that the application can react to.
    Conversely there is no benefit in having different exception types for disk full and disk quota met. The application will respond the same in either case.
    Michael Taylor
    http://blogs.msmvps.com/p3net

  • Exception handling across multiple classes

    Is it possible to throw the exception from one class to another class for exception handling.............. can anyone tell me the way........

    you don't throw it to a specific class. in the method where the exception might be thrown, you can choose to either catch it there, or just re-throw it so that the method before it can choose to catch it or throw it. you know what a stack trace is? it's a chain of methods that were called to get to a certain point in execution, and if an exception is thrown somewhere, either the method in which it is thrown deals with it, or it passes it back to the preceeding method in the stack
    why were you trying to throw it to a class?

  • An exception of class nilobjectexception was not handled (Photoreflect)

    Trying to download photos via Photoreflect.com photo publisher. As soon as I get ready to add photos to a gallery I get a pop up "An exception of class nilobjectexception was not handled. The application must shut down." Tried restart of the computer. Uninstalled and reinstalled the publisher, deleted the Pub data settings file. Still won't work. Thanks in advance for any ideas.
    Rich

    Contact the developer of photoreflect as there is a problem with their code. There may be an update for their application.

  • An exception of class OutOfBounds Exception was not handled

    When starting a vodafone application for my Merlin 3g card I get a failure message: "An exception of class OutOfBounds Exception was not handled. Application must shut down"
    I unintentionally deleted an info.plist file when trying to get rid of Apple´s latest WWAN update. Could this be the reason? And how to get back the info.plist file?
    Thank you
    MacBookPro   Mac OS X (10.4.8)  

    I finally managed to find an Info.plist on the web. I managed to copy it to the IOSerialFamily.kext file and restarted.
    Upon startup I was told that the IOSerialFamily.kext was not installed correctly and cannot be used.
    This is the content I used:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>English</string>
    <key>CFBundleExecutable</key>
    <string>IOSerialFamily</string>
    <key>CFBundleGetInfoString</key>
    <string>Apple Computer, Inc 2005-01-12 IOKit Serial Port Family</string>
    <key>CFBundleIdentifier</key>
    <string>com.apple.iokit.IOSerialFamily</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>IOKit Serial Port Family</string>
    <key>CFBundlePackageType</key>
    <string>KEXT</string>
    <key>CFBundleShortVersionString</key>
    <string>9.0</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>9.0.0d30</string>
    <key>IOKitPersonalities</key>
    <dict>
    <key>IOSerialBSDClient</key>
    <dict>
    <key>CFBundleIdentifier</key>
    <string>com.apple.iokit.IOSerialFamily</string>
    <key>IOClass</key>
    <string>IOSerialBSDClient</string>
    <key>IOProbeScore</key>
    <integer>1000</integer>
    <key>IOProviderClass</key>
    <string>IOSerialStream</string>
    <key>IOResourceMatch</key>
    <string>IOBSD</string>
    </dict>
    <key>IOSerialBSDClientSync</key>
    <dict>
    <key>CFBundleIdentifier</key>
    <string>com.apple.iokit.IOSerialFamily</string>
    <key>IOClass</key>
    <string>IOSerialBSDClient</string>
    <key>IOProbeScore</key>
    <integer>1000</integer>
    <key>IOProviderClass</key>
    <string>IOSerialStreamSync</string>
    <key>IOResourceMatch</key>
    <string>IOBSD</string>
    </dict>
    </dict>
    <key>OSBundleCompatibleVersion</key>
    <string>1.0.4</string>
    <key>OSBundleLibraries</key>
    <dict>
    <key>com.apple.kpi.bsd</key>
    <string>8.0.0</string>
    <key>com.apple.kpi.iokit</key>
    <string>8.0.0</string>
    <key>com.apple.kpi.libkern</key>
    <string>8.0.0</string>
    <key>com.apple.kpi.mach</key>
    <string>8.0.0</string>
    <key>com.apple.kpi.unsupported</key>
    <string>8.0.0</string>
    </dict>
    </dict>
    </plist>
    Any help what I did possibly wrong?

  • SMBup quit. "An exception of class JSONException was not handled. The application must shut down. Exception Message: Parse Error: Expecting "{" or "[" at position 1. Exception Error Number: 1

    After updating to Mavericks 10.9.2, our Canon printer would no longer scan & send to our iMacs & MacBook Pros. We downloaded & installed SMBUp. Still trying to get it to work with MacBookPros, but has been working with iMacs. Today, out of the blue, I got the following error message:
    An exception of class JSONException was not handled. The application must shut down.
    Exception Message: Parse Error: Expecting "{" or "[" at position 1
    Exception Error Number : 1
    Now I get that message every time I try to open SMBUp. Tried to download & reinstall application, but get this message on website:
    Hmm, eduo.info isn't loading right now.
    The servers that run eduo.info are having some trouble. This is usually just a tempoary problem, so you might want to try again in a few minutes.
    (Have gotten that message for the last hour).
    Help?

    Hi,
    Pls don't forget to reward points and close the question if you find the answers useful.
    Eddy

  • Error while running DocumentOutbox handler class in content DB Dev kit

    Hi,
    I am able to compile the DocumentOutbox content handler class which comes with content DB Dev kit. But, when I run scriptdriver.sh, I am getting the following errors in the log file "RegisterDocumentOutbox.out".
    Any help in resolving this would be appreciated
    Next method: setDefaultScriptOperationsClass oracle.ifs.ecm.tools.script.AuditSpecificationOperations
    Exception while invoking method 'setDefaultScriptOperationsClass oracle.ifs.ecm.tools.script.AuditSpecificationOperations' ; exception is:
    java.lang.RuntimeException: Unable to construct operations instance
    java.lang.RuntimeException: Unable to construct operations instance
         at oracle.ifs.ecm.tools.script.EcmScriptDriver.setDefaultScriptOperationsClass(EcmScriptDriver.java:503)
         at oracle.ifs.ecm.tools.script.EcmScriptOperations.setDefaultScriptOperationsClass(EcmScriptOperations.java:522)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at oracle.ifs.ecm.tools.script.EcmScriptDriver.invokeMethod(EcmScriptDriver.java:431)
         at oracle.ifs.ecm.tools.script.EcmScriptDriver.run(EcmScriptDriver.java:257)
         at oracle.ifs.ecm.tools.script.EcmDiffTest.main(EcmDiffTest.java:37)
    elapsed time (ms) = 7
    Next method: identifyByPath domain /oracle
    Exception while invoking method 'identifyByPath domain /oracle' ; exception is:
    java.lang.RuntimeException: Cannot register a null object (domain)
    java.lang.RuntimeException: Cannot register a null object (domain)
         at oracle.ifs.ecm.tools.script.EcmScriptDriver.registerObject(EcmScriptDriver.java:972)
         at oracle.ifs.ecm.tools.script.EcmScriptOperations.registerObject(EcmScriptOperations.java:9220)
         at oracle.ifs.ecm.tools.script.EcmScriptOperations.identifyByPath(EcmScriptOperations.java:4889)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at oracle.ifs.ecm.tools.script.EcmScriptDriver.invokeMethod(EcmScriptDriver.java:431)
         at oracle.ifs.ecm.tools.script.EcmScriptDriver.run(EcmScriptDriver.java:257)
         at oracle.ifs.ecm.tools.script.EcmDiffTest.main(EcmDiffTest.java:37)
    elapsed time (ms) = 69
    Next method: defineAuditTypeListDefinition atl
    Exception while invoking method 'defineAuditTypeListDefinition atl' ; exception is:
    java.lang.RuntimeException: No such method with specified number of arguments (1)
    java.lang.RuntimeException: No such method with specified number of arguments (1)
         at oracle.ifs.ecm.tools.script.EcmScriptDriver.invokeMethod(EcmScriptDriver.java:423)
         at oracle.ifs.ecm.tools.script.EcmScriptDriver.run(EcmScriptDriver.java:257)
         at oracle.ifs.ecm.tools.script.EcmDiffTest.main(EcmDiffTest.java:37)
    elapsed time (ms) = 0
    Next method: addAuditType atl DOCUMENT_CREATED SUCCESS_ONLY
    Exception while invoking method 'addAuditType atl DOCUMENT_CREATED SUCCESS_ONLY' ; exception is:
    java.lang.RuntimeException: No such method with specified number of arguments (3)
    java.lang.RuntimeException: No such method with specified number of arguments (3)
         at oracle.ifs.ecm.tools.script.EcmScriptDriver.invokeMethod(EcmScriptDriver.java:423)
         at oracle.ifs.ecm.tools.script.EcmScriptDriver.run(EcmScriptDriver.java:257)
         at oracle.ifs.ecm.tools.script.EcmDiffTest.main(EcmDiffTest.java:37)
    elapsed time (ms) = 1
    Next method: addAuditType atl DOCUMENT_CREATED_AS_COPY SUCCESS_ONLY
    Exception while invoking method 'addAuditType atl DOCUMENT_CREATED_AS_COPY SUCCESS_ONLY' ; exception is:
    java.lang.RuntimeException: No such method with specified number of arguments (3)
    java.lang.RuntimeException: No such method with specified number of arguments (3)
         at oracle.ifs.ecm.tools.script.EcmScriptDriver.invokeMethod(EcmScriptDriver.java:423)
         at oracle.ifs.ecm.tools.script.EcmScriptDriver.run(EcmScriptDriver.java:257)
         at oracle.ifs.ecm.tools.script.EcmDiffTest.main(EcmDiffTest.java:37)
    elapsed time (ms) = 3
    Next method: addAuditType atl DOCUMENT_BECAME_VERSION SUCCESS_ONLY
    Exception while invoking method 'addAuditType atl DOCUMENT_BECAME_VERSION SUCCESS_ONLY' ; exception is:
    java.lang.RuntimeException: No such method with specified number of arguments (3)
    java.lang.RuntimeException: No such method with specified number of arguments (3)
         at oracle.ifs.ecm.tools.script.EcmScriptDriver.invokeMethod(EcmScriptDriver.java:423)
         at oracle.ifs.ecm.tools.script.EcmScriptDriver.run(EcmScriptDriver.java:257)
         at oracle.ifs.ecm.tools.script.EcmDiffTest.main(EcmDiffTest.java:37)
    elapsed time (ms) = 0
    Next method: addAuditType atl USER_APPLICATION_CONNECTED SUCCESS_ONLY
    Exception while invoking method 'addAuditType atl USER_APPLICATION_CONNECTED SUCCESS_ONLY' ; exception is:
    java.lang.RuntimeException: No such method with specified number of arguments (3)
    java.lang.RuntimeException: No such method with specified number of arguments (3)
         at oracle.ifs.ecm.tools.script.EcmScriptDriver.invokeMethod(EcmScriptDriver.java:423)
         at oracle.ifs.ecm.tools.script.EcmScriptDriver.run(EcmScriptDriver.java:257)
         at oracle.ifs.ecm.tools.script.EcmDiffTest.main(EcmDiffTest.java:37)
    elapsed time (ms) = 1
    Next method: defineAuditTargetSpecificationDefinition ats domain ALL_SUBITEMS
    Exception while invoking method 'defineAuditTargetSpecificationDefinition ats domain ALL_SUBITEMS' ; exception is:
    java.lang.RuntimeException: No such method with specified number of arguments (3)
    java.lang.RuntimeException: No such method with specified number of arguments (3)
         at oracle.ifs.ecm.tools.script.EcmScriptDriver.invokeMethod(EcmScriptDriver.java:423)
         at oracle.ifs.ecm.tools.script.EcmScriptDriver.run(EcmScriptDriver.java:257)
         at oracle.ifs.ecm.tools.script.EcmDiffTest.main(EcmDiffTest.java:37)
    elapsed time (ms) = 0
    Next method: defineAuditHandlerSpecificationDefinition ahs oracle.ifs.examples.handlers.DocumentOutbox 1H 00:30:00 true
    Exception while invoking method 'defineAuditHandlerSpecificationDefinition ahs oracle.ifs.examples.handlers.DocumentOutbox 1H 00:30:00 true' ; exception is:
    java.lang.RuntimeException: No such method with specified number of arguments (5)
    java.lang.RuntimeException: No such method with specified number of arguments (5)
         at oracle.ifs.ecm.tools.script.EcmScriptDriver.invokeMethod(EcmScriptDriver.java:423)
         at oracle.ifs.ecm.tools.script.EcmScriptDriver.run(EcmScriptDriver.java:257)
         at oracle.ifs.ecm.tools.script.EcmDiffTest.main(EcmDiffTest.java:37)
    elapsed time (ms) = 0
    Next method: createAuditSpecification DocOutboxSpec atl ats ahs "DocumentOutbox AuditSpecification"
    Exception while invoking method 'createAuditSpecification DocOutboxSpec atl ats ahs "DocumentOutbox AuditSpecification"' ; exception is:
    java.lang.RuntimeException: No such method with specified number of arguments (5)
    java.lang.RuntimeException: No such method with specified number of arguments (5)
         at oracle.ifs.ecm.tools.script.EcmScriptDriver.invokeMethod(EcmScriptDriver.java:423)
         at oracle.ifs.ecm.tools.script.EcmScriptDriver.run(EcmScriptDriver.java:257)
         at oracle.ifs.ecm.tools.script.EcmDiffTest.main(EcmDiffTest.java:37)
    elapsed time (ms) = 0
    Next method: showAuditSpecification DocOutboxSpec
    Exception while invoking method 'showAuditSpecification DocOutboxSpec' ; exception is:
    java.lang.RuntimeException: unknown object tag: DocOutboxSpec
    java.lang.RuntimeException: unknown object tag: DocOutboxSpec
         at oracle.ifs.ecm.tools.script.EcmScriptDriver.lookupObject(EcmScriptDriver.java:857)
         at oracle.ifs.ecm.tools.script.EcmScriptOperations.lookupObject(EcmScriptOperations.java:9140)
         at oracle.ifs.ecm.tools.script.EcmScriptOperations.showAuditSpecification(EcmScriptOperations.java:1572)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at oracle.ifs.ecm.tools.script.EcmScriptDriver.invokeMethod(EcmScriptDriver.java:431)
         at oracle.ifs.ecm.tools.script.EcmScriptDriver.run(EcmScriptDriver.java:257)
         at oracle.ifs.ecm.tools.script.EcmDiffTest.main(EcmDiffTest.java:37)
    elapsed time (ms) = 1
    Thanks in Advance

    A parent folder must have set workflow configuration to be final - thus preventing any sub-folders from changing the policy.
    Work your way through the various parent folders (via Web UI), and ensure "Do not allow subfolders to modify this operation's workflow settings" for the particular workflow/operation combination is not set.
    Matt.

  • ADF Task Flow Exception Handling

    Hi ,
    I tried a very simple thing for taskFlow exception handling.
    I created a bounded task flow with a page fragment (View1.jsff) and another view which is the TaskFlow ExceptionHandler (error.jsff).
    The view1.jsff has a button whose action is bound to the backing bean. In the backingBean method I deliberately do division by 0.
    Since this is an unHandled exception, I would have expected the control to come to error.jsff. But, instead I am shown a pop up box with the error message.
    Why is the control not getting redirected to error.jsff ?
    Thanks.
    S.Srivatsa Sivan

    Hi Frank , im having the same problem.
    I want to handle exceptions that occur while navigating task flows (example: A user navigates to a task flow that he/she does not have view permission)
    I tried using a view activity and method activity as the exception handler but none of them works, the exception is still not handles. It does not even navigate to the exception handler on the task flow.
    on the view page i have:
    <af:panelStretchLayout topHeight="50px" id="psl1">
    <f:facet name="top">
    <af:panelGroupLayout layout="scroll"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
    id="pgl1">
    Error message:  
    <af:outputText value="#{controllerContext.currentRootViewPort.exceptionData.message}" id="ot2"/>
    </af:panelGroupLayout>
    </f:facet>
    <f:facet name="center">
    <af:outputText value="#{my_exception_Handler.stackTrace}" id="ot1"/>
    <!-- id="af_one_column_header_stretched" -->
    </f:facet>
    </af:panelStretchLayout>
    I tried getting the error message and stacktrace from the controllerContext via EL like this "#{controllerContext.currentRootViewPort.exceptionData.message}"
    and from the controllerContext class in functions that i have declared in my_exception_Handler class like this
    " ControllerContext ctx = ControllerContext.getInstance();
    ViewPortContext vCtx = ctx.getCurrentViewPort();
    if(vCtx.getExceptionData() != null){
    StringWriter stringWriter = new StringWriter();
    PrintWriter printWriter = new PrintWriter(stringWriter);
    vCtx.getExceptionData().printStackTrace(printWriter);
    return stringWriter.toString();"
    But all this dont even matter because when the exception occurs on the task flow it does not navigate to the default exception handler.
    thanks for your interest and help in advance.
    Cyborg_0912

  • Best Practice for Implementing Exception Handling in BPEL

    Hi All,
    what is the best practice and the approach to follow Exception Handling in BPEL.
    1) Do we need to implement Exception Handling in BPEL as we do in Java, means
         method 3 throws error to method 2 (if any) and
         method 2 throws error to method 1 (if any) and
         finally method 1 throws error to the main Class.
    If we replicate the above scenario to BPEL
    In BPEL main Scope have Custom Fault, Catch ALL
         Each Invoke is surrounded by a Scope Activity with Remote Fault, Binding Fault & Custom Fault
    and follow the paradigm of Java, assuming we have Inner Scopes
         [ OR ]
    2) In BPEL main Scope have all exceptions defined like
         Remote Fault,
         Binding Fault,
         anyOther System Fault (selectionFailure / forcedTermination),
         Custom Fault (if required) and
         CatchALL
         and also
         each Invoke is surrounded by a Scopes Acitivity with Custom Fault (business fault) exception Handling
    I feel 1st one may not be a good practice, may be i am wrong...
    Any Suggestions from experts.
    Thanks in Advance
    anvv sharma

    Hi-
    In you can create different scope and use catch branch to catch binding, remote, custom faults, business faults etc. If an error happens in a scope it will not move to the next scope( eg: you have 3 scope, error occured in 2nd scope then it will not propogate to the 3rd scope. One thing to be noticed here is your transaction in the 1st scope doesnt gets commited when an error happens in 2d scope).
    You can have a catch all to catch error which are not being caught at catch level. So if any error happens which is not defined in catch block then then it will be caught in catch all branch.
    Edited by: 333333 on Apr 12, 2011 9:39 AM

  • Exception Handling In Struts, Declarative, programatic and customized excep

    hello .
    I'm workingon exception handling in struts , i executed the gobal exceptions.
    In glabal exception handling , one will not get the root cause of exception , rather we print the message from resource bundle.
    How to get the root cause of exception in jsp page.
    Give me sample code to deal with ExceptionHandler claas.
    Thank u
    Roshu

    Hi ,
    I am in the same situation. Global exception is working fine in my struts application . But I need to show the exception stack trace also in the screen whenever the exception occurs.Can anyone please provide me a sample code to deal with ExceptionHandler class ?
    Thanks in advance...
    Regards,
    BG

  • Exception Handling-rite way??

    Hi Friends,
    This Exception handling is really causing some problems for me.I run a query,return the resultset,cook the data from my other java class and display it thru my jsp and the last statement from my jsp is to call the close method(commented out).The problem is if some unknown Exception arises the close() method is not being called,causing open connections which later on are
    creating some disasters.I tried to implement it now using the finally method,so that it always gets closed,but hte problem is when i call the ReturnResultSet() method and try to cook the data,it says "ResultSet Closed".Please tell me which is the right way to implement this:
    public ResultSet ReturnResultSet(String Query) throws Exception
         try{  
           if (datasource != null) {
             connection = datasource.getConnection();
             if (connection != null) {
               statement = connection.createStatement( );
               resultset = statement.executeQuery(Query);         
           return resultset;
         } catch (SQLException sqle)
           sqle.printStackTrace();
           return null;
         finally {       
         try {
           if (resultset != null) resultset.close();
           if (statement != null) statement.close();
           if (connection != null) connection.close();
         catch (SQLException sqle) {
           sqle.printStackTrace();
    public void close()
       try { resultset.close(); } catch (Exception ex) {}
       try { statement.close(); } catch (Exception ex) {}
       try { connection.close(); } catch (Exception ex) {}
    */Any help would be appreciated and some duke dollars would be awarded too.Thanks

    Ok I think i got your point and i should award you
    the duke dollars too,but one last thing to ask.I call
    the close() method after all my processing is over,I
    just
    wanna know should I have the connection.close() thing
    inside it,becuase dont that contradicts the whole
    connection pool thing,as i am closing a connection
    and it has to open a new connection for every
    request.Or should i just have resultset.close() and
    statement.close() in it.
    Thanks for all your helpAre you talking about a standard J2EE container-provided connection pool? If so, then yes, you still need to 'close' the connection. That doesn't actually close it, it just tells the pool it is available to be used again the next time someone asks it for a connection. Hopefully you're not writing your own home-grown "connection pool".

Maybe you are looking for