Webservices and custom exception handling

hi all,
I have one ejb method which promote as webservices.
@WebMethod
@Oneway
public void test(String arg) throws STARS21BOException{
my Custom Exception class STARS21BOException extends from EjbException and it has no-arg constructor.
but when i deploy on server i get following exception.
if i remove throws clause from method, it is working fine.
javax.xml.ws.WebServiceException: Unable to create JAXBContext
     at com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:158)
     at com.sun.xml.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:87)
     at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:271)
     at com.sun.xml.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:351)
     at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:201)
     Truncated. see log file for complete stacktrace
Caused By: java.security.PrivilegedActionException: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
java.lang.StackTraceElement does not have a no-arg default constructor.
     this problem is related to the following location:
          at java.lang.StackTraceElement
          at public java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace()
          at java.lang.Throwable
          at java.lang.Exception
          at public java.lang.Exception sg.com.stee.stars21.showcase.business.jaxws.STARS21BOExceptionBean.causedByException
          at sg.com.stee.stars21.showcase.business.jaxws.STARS21BOExceptionBean
     at java.security.AccessController.doPrivileged(Native Method)
     at com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:148)
     at com.sun.xml.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:87)
     at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:271)
     at com.sun.xml.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:351)
     Truncated. see log file for complete stacktrace
Caused By: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
java.lang.StackTraceElement does not have a no-arg default constructor.
     this problem is related to the following location:
          at java.lang.StackTraceElement
          at public java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace()
          at java.lang.Throwable
          at java.lang.Exception
          at public java.lang.Exception sg.com.stee.stars21.showcase.business.jaxws.STARS21BOExceptionBean.causedByException
          at sg.com.stee.stars21.showcase.business.jaxws.STARS21BOExceptionBean
     at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:102)
     at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:438)
     at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:286)
     at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:139)
     at com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:105)
     Truncated. see log file for complete stacktrace
>
<Apr 23, 2010 10:51:33 AM SGT> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID '1271991082383' for task '2'. Error is: 'weblogic.application.ModuleException: Exception activating module: EJBModule(ejb-showcaseEJB.jar)

newt.mm wrote:
@WebMethod
@Oneway
public void test(String arg) throws STARS21BOException{
}As per method signature it is asynchronous web service however you are trying to throw soap fault. Isn't the soap fault is also a kind of response?
Do you really want your web method to be asynchronous?

Similar Messages

  • Problems with Custom Exception Handler

    Hi,
    I have defined a custom exception handler for my workflow (WebLogic Platform
    7).
    I have a workflow variable called 'count' , which gets incremented for every
    time an exception occurs.
    The exception handler checks if the count is less than 3(using evaluate
    condition),
    if yes then it executes the action "Exit Execption Handler and retry"
    else
    it executes the action "Exit Execption Handler and continue"
    The Workflow simply hangs, nothing on the console , the worklist from which
    i call it hangs too.
    Has anyone managed to use this kind of exception handling?
    Thanks in advance,
    Asif

    bill0 wrote:
    > Thanks for all the help but still no luck.
    >
    > The directory is d:\wSites\GBMain\html\CFMS> and I am
    mapped to it as x:\CFMS.
    > Most of the cfm files are in CFMS but Application.cfm is
    1 directory up in
    > html. I have tried misscfm.cfm in both html and CFMS but
    had no luck having it
    > find a non existant template referred to in a cfinclude
    or a form's action
    > attribute. The default ColdFusion error handler is what
    shows. The missing
    > template handler box says /misscfm.cfm. Misscfm.cfm is
    text followed by a
    > <cfabort>. We use ColdFusion MX6.1
    >
    > I hope that is enough information to figure what am I
    missing and/or doing
    > wrong.
    >
    >
    Is the 'misscfm.cfm' file somewhere in the
    'd:\wSites\GBMain\html\CFMS\'
    directory. I will presume this is the 'web root' as defined
    in your web
    server (IIS or Apache or built-in or ???). The missing
    template handler
    file needs to be in the ColdFusion root. This is going to be
    a
    directory such as
    '{drive}:\JRun4\servers\{server}\cfusion-ear\cfusion-war\misscfm.cfm'
    for J2EE flavors OR '{drive}:\CFusionMX\wwwroot' for Standard
    I think.
    It has been a very long time since I have dealt with
    Standard.
    This is probably completely different from the above web
    root. That is
    the point I am trying to get across. ColdFusion has TWO roots
    where it
    will look for a CFML file. But the Missing and Sitewide
    templates can
    only be in the ColdFusion root listed above, they will not
    work in the
    web root.
    HTH
    Ian

  • EDT custom exception handler

    Hi,
    Is there any posibility to add custom exception handler to EDT? I'm thinking to implement an automatic feed-back from a client aplication. When an exception occurs in EDT it will automatically send to server. The problem is that unsigned webstart application have no permissions to call Thread.setUncaughtExceptionHandler() on EDT.
    Is there any workaround?
    Anton

    Hi,
    Is there any posibility to add custom exception handler to EDT? I'm thinking to implement an automatic feed-back from a client aplication. When an exception occurs in EDT it will automatically send to server. The problem is that unsigned webstart application have no permissions to call Thread.setUncaughtExceptionHandler() on EDT.
    Is there any workaround?
    Anton

  • Add three stored procs in one big proc and add exception handling

    I have three proc's,
    1. sp_staging
    2.  sp_upload
    3. sp_process.
    Now, I have to create a new proc as sp_daily which has the other three proc's in it in the same order.
    if the first proc sp_staging fails, then the sp_daily proc should stop executing the other proc's which are in the order.
    CREATE PROCEDURE sp_daily
    AS
    BEGIN TRY
    EXEC sp_staging (already has EXCEPTION handling IN it)
    GO
    EXEC sp_upload (already has EXCEPTION handling IN it)
    GO
    EXEC sp_process (already has EXCEPTION handling IN it)
    GO
    END TRY
    BEGIN CATCH
    -- If any of the above proc's fail, the next proc's should not be executed
    END CATCH
    Something like this????

    Hi naveej,
    Whether the Stored Procedure sp_daily stops executing if the first sp_staging fails depends on how you code. To give a better demonstration, I will show the scenario that sp_upload runs with error. Please see the below code.
    --create the scenario
    USE master;
    IF db_id('TestDB') IS NULL
    CREATE DATABASE TestDB;
    USE TestDB;
    IF OBJECT_ID('T1') IS NOT NULL
    DROP TABLE T1;
    GO
    CREATE TABLE T1
    procName varchar(99)
    IF OBJECT_ID('sp_staging') IS NOT NULL
    DROP PROCEDURE "sp_staging";
    GO
    CREATE PROCEDURE "sp_staging" @denominator FLOAT
    AS
    BEGIN TRY
    DECLARE @quotient FLOAT;
    SET @denominator=1/@denominator; -- when @denominator=0, error occurs
    INSERT INTO T1 VALUES('sp_staging finished');
    END TRY
    BEGIN CATCH
    END CATCH
    GO
    IF OBJECT_ID('sp_upload') IS NOT NULL
    DROP PROCEDURE "sp_upload";
    GO
    CREATE PROCEDURE "sp_upload" @denominator FLOAT
    AS
    BEGIN TRY
    DECLARE @quotient FLOAT;
    SET @denominator=1/@denominator;
    INSERT INTO T1 VALUES('sp_upload finished');
    END TRY
    BEGIN CATCH
    DECLARE @ERRMSG VARCHAR(99);
    SELECT @ERRMSG=ERROR_MESSAGE()+'sp_upload failed, process continues';
    INSERT INTO T1 VALUES(@ERRMSG);
    END CATCH
    GO
    IF OBJECT_ID('sp_process') IS NOT NULL
    DROP PROCEDURE "sp_process";
    GO
    CREATE PROCEDURE "sp_process" @denominator FLOAT
    AS
    BEGIN TRY
    DECLARE @quotient FLOAT;
    SET @denominator=1/@denominator;
    INSERT INTO T1 VALUES('sp_process finished');
    END TRY
    BEGIN CATCH
    END CATCH
    GO
    IF OBJECT_ID('sp_daily') IS NOT NULL
    DROP PROCEDURE "sp_daily";
    GO
    CREATE PROCEDURE "sp_daily" @p1Deno FLOAT,@p2Deno FLOAT,@p3Deno FLOAT
    AS
    BEGIN TRY
    EXEC sp_staging @p1Deno;
    EXEC sp_upload @p2Deno;
    EXEC sp_process @p3Deno;
    END TRY
    BEGIN CATCH
    INSERT INTO T1 SELECT ERROR_MESSAGE()+'error captured by sp_daily';
    END CATCH
    GO
    --Test Example
    TRUNCATE TABLE T1;
    EXEC sp_daily 1,0,1;
    SELECT * FROM T1;
    We can judge from the rows in T1, sp_daily continued even when there came a error in sp_upload. The reason for the continuity is that the error which occurred in sp_upload was caught and handled by  sp_upload itself. Sp_daily's CATCH block didn't capture
    any error(we didnt see any row like "error captured by sp_daily") so  sp_dailys continued running with no interruption.
    Let’s make a little modification on the sp_upload. see the below code.
    ALTER PROCEDURE "sp_upload" @denominator FLOAT
    AS
    BEGIN TRY
    DECLARE @quotient FLOAT;
    SET @denominator=1/@denominator;
    INSERT INTO T1 VALUES('sp_upload');
    END TRY
    BEGIN CATCH
    DECLARE @ERRMSG VARCHAR(99),@ErrSeverity INT;
    SELECT @ERRMSG=ERROR_MESSAGE()+'sp_upload failed, process got terminated',@ErrSeverity=ERROR_SEVERITY();
    RAISERROR(@ERRMSG ,@ErrSeverity,1);
    END CATCH
    GO
    --Test Example
    TRUNCATE TABLE T1;
    EXEC sp_daily 1,0,1;
    SELECT * FROM T1;
    At this time,  sp_daily got terminated when  sp_upload encountered an error. Sp_upload didn’t handle the error, it threw the error instead. Then the CATCH block in  sp_daily caught  the error and interrupted sp_daily itself. If you don’t
    need to handle the error which may occur inside of the inner called procedures, the TRY and CATCH block in the procedure which calls them would be enough to catch and handle the errors anywhere it occurs, just remove the blocks from the called ones.
    ALTER PROCEDURE "sp_staging" @denominator FLOAT
    AS
    DECLARE @quotient FLOAT;
    SET @denominator=1/@denominator;
    INSERT INTO T1 VALUES('sp_staging finished');
    GO
    ALTER PROCEDURE "sp_upload" @denominator FLOAT
    AS
    DECLARE @quotient FLOAT;
    SET @denominator=1/@denominator;
    INSERT INTO T1 VALUES('sp_upload finished');
    GO
    ALTER PROCEDURE "sp_process" @denominator FLOAT
    AS
    DECLARE @quotient FLOAT;
    SET @denominator=1/@denominator;
    INSERT INTO T1 VALUES('sp_process finished');
    GO
    ALTER PROCEDURE "sp_daily" @p1Deno FLOAT,@p2Deno FLOAT,@p3Deno FLOAT
    AS
    BEGIN TRY
    EXEC sp_staging @p1Deno;
    EXEC sp_upload @p2Deno;
    EXEC sp_process @p3Deno;
    END TRY
    BEGIN CATCH
    INSERT INTO T1 SELECT ERROR_MESSAGE();
    END CATCH
    GO
    --Test Example
    TRUNCATE TABLE T1;
    EXEC sp_daily 1,0,1;
    SELECT * FROM T1;
    As we can see from the above modification,  sp_daily calls  sp_staging, sp_upload, sp_process in order. Sp_staging runs fine so it finishes. When it comes to sp_upload, error gets captured so the execution terminates. Anyway if you hope that the 3
    called procedures  work atomically(it is a pretty common business requirement), which means unless all of the three finish otherwise no one finishes, the TRAN block would help. Please see the below code.
    ALTER PROCEDURE "sp_daily" @p1Deno FLOAT,@p2Deno FLOAT,@p3Deno FLOAT
    AS
    BEGIN TRY
    BEGIN TRAN
    EXEC sp_staging @p1Deno;
    EXEC sp_upload @p2Deno;
    EXEC sp_process @p3Deno;
    COMMIT TRAN;
    END TRY
    BEGIN CATCH
    ROLLBACK TRAN;
    INSERT INTO T1 SELECT ERROR_MESSAGE();
    END CATCH
    GO
    --Test Example
    TRUNCATE TABLE T1;
    EXEC sp_daily 1,0,1;
    SELECT * FROM T1;
    If you have question, feel free to let me know.
    Best Regards,
    Eric Zhang

  • Get Attribute values from a page and procedure exception handling?

    Hi All,
    I have created new page with two input attributes not based on any VO. This page is created to capture two values and pass these to an AM method upon pressing OK button. The method in AM will call a procedure with two in parameter expecting the two values captured from the above said page.
    I have two questions, first one how to capture the values entered by the page in the controller class and advises me how to handle exceptions when my procedure fails.
    I can not use something like this since this page is not based on a VO
    String fromName = (String)vo.getCurrentRow().getAttribute("FromName");
    Do I have to create a dummy VO like select '' name1, '' name2 from dual?
    Thanks for the help.

    Hi,
    Actually you can capture the parameters on the page like this way
    String test = (String)pageContext.getParameter("id of the text input bean");
    Now in procedure you can take an out parameter which stores the error messages on exception
    and return that out parameter in java.
    and then you can throw exception on page using OAException class.
    Thanks
    Gaurav Sharma

  • OBIEE webservices and custom application

    Hi all,
    am a newbie to these oracle technologies.am a .net developer.
    and my question is related to OBIEE webservices.
    1.i was able to access a webservice(http://xxxxx:9704/analytics/saw.dll?wsdl).now my requirement is simple.i want to access a report data from obiee page.
    2. like on clicking "go"the report in obiee is displayed.so i need that report data .
    i came to know that it was exposed through webservices.but am unable to found which is the correct function and how to call it?
    please help. i need it urgently.thanks in advance
    Regards,
    Pavan

    hi gerardnico & all other experts,
    how are you?
    i haven't got any breakthrough from one month .but i have learned a little bit about obiee.
    correct me if am wrong any where
    am using a obiee 10.1.3.4
    1. obiee has a bug to"print to pdf". if am using any HTML code within narrative or a TEXT control on the answers/dashboard sections; it doen't give you exact format of the dashboard in to the pdf.; even same with download options
    2.so i started to prepare a custom page(it may be either java or .NET or Flex) to do export to pdf
    3. for this when ever am using those two controls on the dashboard; within simple JavaScript code am giving the end user(on dashboard) a custom button named as "export to pdf".
    4. Now my problem is to know the where is the user right now on the OBIEE portal/webpages . so that i have to know which dashboard he is seeing;what are the reports init;and get concerned HTML,styles data into my custom page; finally i will take care of how to make a pdf in my custom page.
    for all these things i need to communicate between my custom page and the obiee dashboard;;;the only option is webservice call; i need to trap the concerned dashboard name or something from the page and send it to my custom page.
    Hope you understood my problem. please help me if you have any suggestions for me.am working on this from so long
    Thanks & Regards,
    Pavan N

  • Trying to use Message Signing with Webservices and getting exception!

    Here is the exception I'm getting....
    java.rmi.RemoteException: SOAP Fault:javax.xml.rpc.soap.SOAPFaultException: [Security:090377]Identity Assertion Failed, weblogic.security.spi.IdentityAssertionException: [Security:090245]No mapping for Identity User Name
    Detail:
    null; nested exception is:
         javax.xml.rpc.soap.SOAPFaultException: [Security:090377]Identity Assertion Failed, weblogic.security.spi.IdentityAssertionException: [Security:090245]No mapping for Identity User Name
    java.rmi.RemoteException: SOAP Fault:javax.xml.rpc.soap.SOAPFaultException: [Security:090377]Identity Assertion Failed, weblogic.security.spi.IdentityAssertionException: [Security:090245]No mapping for Identity User Name
    Detail:
    null; nested exception is:
         javax.xml.rpc.soap.SOAPFaultException: [Security:090377]Identity Assertion Failed, weblogic.security.spi.IdentityAssertionException: [Security:090245]No mapping for Identity User Name
    I followed step by step the example given on the Weblogic "edocs" pages, but I am at a loss as to what to put on the Identity Asserter Detail screen under "Default User Name Mapper Attribute Type" and "Default User Name Mapper Attribute Delimiter".
    I'm using the example code you can find at the following URL - http://e-docs.bea.com/wls/docs81/webserv/security.html#1061856
    I'm creating my client key pair as specified with a keyname of client_key and password of client_key_password.
    I'm also creating a user in the Admin Console called auth_user with a password of auth_user_password.
    HELP!!!!!

    The error message means you haven't configured the identity mapping between your client cert and a WLS user.
    Here is the WLST script I used in my dev2dev sample(https://codesamples.projects.dev2dev.bea.com/servlets/Scarab?id=S18)
    rlm = cmo.getSecurityConfiguration().getDefaultRealm()
    ia = rlm.lookupAuthenticationProvider("DefaultIdentityAsserter")
    activeTypesValue = array(["X.509"],java.lang.String)
    ia.setActiveTypes(activeTypesValue)
    ia.setDefaultUserNameMapperAttributeType('CN');
    ia.setUseDefaultUserNameMapper(Boolean('true'));
    So I add the X.509 to the ActiveTypes of IdentityAsserter, then I choose the "CN" as the DefaultUserNameMapperAttributeType, finally enable UseDefaultUserNameMapper.

  • Custom code as an exception handler not working.

    Hi,
    I worked on Custom Handler for unauthorized access to a taskflow following the link below and it worked. But a special case in this doesn't work.
    http://download.oracle.com/docs/cd/E14571_01/web.1111/b31974/taskflows_complex.htm#ADFFD22602
    Scenario-1: I have a link that opens an unauthorized taskflow as blank page. I tried the solution of custom handler and am able to display message or display error page --- WORKS FINE
    Scenario-2: I have a link that opens an unauthorized taskflow in a pop-up as blank page. The above solution doesn't work. I tried displaying SOPs but nothing gets print --- DOESN'T WORK.
    Details:
    The custom handler doesn't work with Pop-ups. I have an unauthorized taskflow that gets called inside a pop-up using a link. Being an unauthorized user, I click on the link and it pops-up with a blank page. As per the custom handler it is supposed to display error-page. But it doesn't.
    I tried displaying SOPs inside the handleException method and nothing prints. The exception handler is unable to catch the exception. If this use-case throws some exception, my exception handler would have handle it but it doesn't raise any exception.
    Is this something issue that I need to discuss with FMW team?
    Any workaround for this would be of great help.
    Code Sample:
    public void handleException(FacesContext facesContext, Throwable throwable,
    PhaseId phaseId) throws Throwable {
    String errorMessage = throwable.getMessage();
    if (errorMessage != null && errorMessage.indexOf("ADFC-0619") > -1) {
    setEL("#{sessionScope.errorMessage}",
    "You are not authorized to view this page.");
    ExternalContext externalContext =
    facesContext.getExternalContext();
    externalContext.redirect("ErrorPage");
    } else {
    super.handleException(facesContext, throwable, phaseId);
    Thanks
    Raza

    Hi Frank,
    This scenario is not specific to a particular TaskFlow. In General, there are links in some views, that invokes taskflows and a particular user may not have permission to that TaskFlow. In this scenario, I am not sure where I need to define the method or router. And Hence I registered the Custom Exception Handler as a service as per the documentation.
    But the logic in documentation doesn't work with Pop-ups.
    Thanks
    Raza

  • Exception Handling in Web Center for UI related Errors not working.

    Hi Guys,
    I have implemented Error Handling in ADF Application with Custom Model Exception Handler ( which is "CustomExceptionHandler extends DCErrorHandlerImpl") to catch all Model Layer Exception and to customize those error messages.
    I have implemented Error Handling in ADF Application with Custom View Exception Handler ( which is "CustomViewErrorHandler extends oracle.adf.view.rich.context.ExceptionHandler";) to catch all View Layer Exception and to customize those error messages.
    The design for this is , in Model Custom Exception Handler i find the exception message in "public String getDisplayMessage(BindingContext bindingContext,Exception exception) " method and throw RuntimeException to pass this exception to Custom View Layer Exception , so that i can handle all the exception @ View Layer it self .
    In the View Layer Exception Handler i am navigating to specific error page using
    String contextPath = ((HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest()).getContextPath();
    ExternalContext ectx = facesContext.getExternalContext();
    ectx.redirect.
    All these things absolutly working in ADF Application for all the exception ( Model , View ) and i am successfully navigating to error page.
    Problem  :
    When i implement the same thing in Webcenter Application ( Model Custom Exception Handler and View Custom Exception Handler), Model Part is working as expected , but View Custom Exception Handler is not all calling .
    i am assuming that ,this View Custom Exception Handler (CustomViewErrorHandler extends oracle.adf.view.rich.context.ExceptionHandler) works only for JSF Life cycle
    "Allows frameworks to intercept otherwise unhandled exceptions thrown during the JSF lifecycle. ExceptionHandlers can be registered by adding a service file with a class name at META-INF/services/oracle.adf.view.rich.context.ExceptionHandler." from http://jdevadf.oracle.com/adf-richclient-demo/docs/apidocs/oracle/adf/view/rich/context/ExceptionHandler.html";
    As Webcenter Portal uses ADF Life Cycle this Exception Handler is not calling , i am not sure.
    if any one has any idea please let me know .
    Thanks
    Annapareddy Srinivasrao
    Edited by: Srinivasrao Annapareddy on May 22, 2013 12:06 PM

    i used runtime exception along with the wdwsmodel exception

  • Struts exception handling - Exception handler

    Hi ,
    I need some help for struts exception handling . 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.I guess this can be achieved if we use a custom exception handler instead of struts default exception handler . Can anyone please provide me a sample code to deal with a custom ExceptionHandler class ?
    Thanks in advance...
    Regards,
    BG

    The struts provides org.apache.struts.action.ExceptionHandler class for creating the custom exception handlers. All the custom Exception Handlers should extend the ExceptionHandler class and override the execute() method.
    //An Example
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.action.ExceptionHandler;
    import org.apache.struts.config.ExceptionConfig;
    public class CustomExceptionHandler extends ExceptionHandler {
    public ActionForward execute(Exception exception, ExceptionConfig config, ActionMapping mapping, ActionForm formInstance,
    HttpServletRequest request, HttpServletResponse response) throws ServletException {
    try {
    // TODO CustomeCode
    System.out.println("Exception Handler for the specific error");
    }catch (Exception e) {
    return (super.execute(exception, config, mapping, formInstance, request, response));
    Struts-config.xml File
    <exception key="error.system" type="java.lang.RuntimeException"
    handler="com.visualbuilder.handler.CustomExceptionHandler" path="/index.jsp" />
    Note:- This will transfer the control to the index.jsp after calling the exception handler. In the struts-config.xml we are adding the global exception for RuntimeException. You can add any exception like the previous example to some actions only.
    I have taken this example from following link. You may visit it.
    http://www.visualbuilder.com/jsp/struts/tutorial/pageorder/38/
    I would like if you share knowledge with me.

  • Is Exception handler necessary for every stored subprogram

    Hi All,
    I knwo exception handler is very important. But is it necessary for every stored procedure or function?
    For example,
    procedure test(p_index_code IN varchar2(10)
    p_changed_code OUT varchar2(15))
    as
    begin
    IF p_index_code = 'A' then
    p_changed_code := 'A'|| p_index_code;
    elsif p_index_code = 'B' then
    p_changed_code := 'B'|| p_index_code;
    else
    p_changed_code := p_index_code;
    end if;
    end;
    This kind of simple procedures, do I have to add the 'exection when others than raise_application_error(-20001,'error in this SP')'?
    I can't see obvious drawbacks without the exception handler in this CASE.
    Best regards,
    Leon
    Edited by: user12064076 on Nov 11, 2010 7:12 PM

    user12064076 wrote:
    I knwo exception handler is very important. But is it necessary for every stored procedure or function?It is important to know WHY an exception handler is needed. There are couple of basic reasons why you want to use an exception handler.
    The exception is not an error.
    The exception raised is a technical error, but may not be a business or processing error. The typical example is the NO_DATA_FOUND exception. The business logic may say "+when there is no fixed discounts found, apply a 5% dis-count+". So not finding (dis-count) row data in such a case is not an exception. What does you exception handler do? It fixes the exception and there is not an exception anymore. In other words, the caller that called your code will never know that there was an exception.
    Making the exception meaningful
    An exception, like NO_DATA_FOUND, is not very meaningful. What is meaningful is NO_INVOICE_FOUND or NO_CUSTOMER_FOUND. Thus your exception handler can catch a generic exception and make it more meaningful by returning a custom application exception instead.
    Action stations
    Some exceptions will require you to clean up and fix what you can - kind of like action stations when a ship takes a hit. But as you cannot fix the exception, the exception must be passed to the caller so that it too can decide how to re-act to that exception. For example, you may have an open ref cursor or open UTL_FILE handle that needs to be closed when your code terminates. If not, your code will leak resources. So you need to trap exceptions that can occur, clean up, and then re-raise the exception (this is called a resource protection code block in other languages). You may have done a partial transaction - and the exception handler may need to roll back the changes your code made. The bottom line here is that you must re-raise the exception after you have done your "+action stations+" bit. You did not fix the exception. You did not make it more meaningful. In that case you must pass it back to the caller so that it can decide what it needs to do about that exception.
    Using an exception for any other reason - that would likely be the wrong thing to do most of the time.

  • Exception Handling in ADF 10g

    Hi everybody,
    I want to develop an application and need exception handling.
    I have a helper application that contains this classes:
    MyADFPhaseListener extends ADFPhaseListener that return this: return new MyFacesPageLifecycle(),
    MyErrorHandler extends DCErrorHandlerImpl,
    MyFacesPageLifecycle extends FacesPageLifecycle that contain this methods:
    prepareModel(LifecycleContext ctx) that set my errorhandler with this: ctx.getBindingContext().setErrorHandler(new MyErrorHandler(true));
    and
    reportErrors(PageLifecycleContext ctx){
    DCBindingContainer bc = (DCBindingContainer)ctx.getBindingContainer();
    if (bc != null) {
    ArrayList<Exception> exceptions =new ArrayList<Exception>();
    exceptions = bc.getExceptionsList();
    if (exceptions != null) {
    /*handle exceptions*/
    My problem is here:
    when throw an exception in my app like this: throw new JboException("Don't do that.", "101", null);
    after create pagelifecycle and calling prepareModel(), reporterros() dose not call....!!!
    why?
    Edited by: 859070 on May 15, 2011 9:35 PM

    when click a button and call action of this button.
    please note:
    My helper application and main application are apart. I deploy helper application to jar file and use this jar file in main application.
    Maybe exceptions don`t send to reportErrors() method in MyPageLifeCycle class, because i create a test class like this:
    public class test {
    public static void main(String[] args) throws SQLException {
    ArrayList<Exception> exss = new ArrayList<Exception>();
    exss.add(new JboException("A fatal exception is occurred",
    "103", null));
    exss.add(new NullPointerException());
    exss.add(new SQLException());
    MyFacesPageLifecycle efpl =new MyFacesPageLifecycle();
    efpl.errorReporter(exss);
    Body of errorReporter(ArrayList<Exception>) method is like reportErrors(PageLifecycleContext) just parameter is different.
    public void errorReporter(ArrayList<Exception> excs) {
    if (excs != null) {
    for (Exception exception: excs) {
    if(exception instanceof JboException){
    System.out.println("JBOException is occurred here: "+exception.getMessage());
    else if(exception instanceof SQLException){
    System.out.println("SQLException is occurred here");
    else if(exception instanceof NullPointerException){
    System.out.println("NullPointerException is occurred here");
    else{
    and this handle exceptions list. My opinion is that exceptions between different applications(helper and main) are lost. is this correct?

  • Exception Handling in Stripes framework

    Pls help me to setup the Exception handling...
    1.how to catch the exception occuring in ActionBean method,using our custom
    exception handle method?
    not sure to integrate this both?
    http://stripesframework.org/display/stripes/Exception+Handling
    becas in the example it shows only the MyExceptionHandler class ...how it is
    linked to the method in the ActionBean
    Thanks
    Kris

    The same answer as in: http://forum.java.sun.com/thread.jspa?threadID=5264689

  • 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 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

Maybe you are looking for

  • Recursive Structure

    Hi, I need to generate target recursive structure dynamically. When I right click on recursive node (In message mapping), it gives me option "Expand Recursive Structure". But how to achieve this dynamically (run time)? Any help would be appreciated.

  • Cannot find itunes rental movie that has been downloaded

    cannot find itunes rental movie that has been downloaded.  I purchased one movie and it shows up --- the 2 rental movies do not.  Help please - I am going overseas tonight and would love to watch these movies.  I understood I have 30 days to open and

  • Is there a way to set Explicit Content to play/not play on an Ipod Classic?

    Hi, I've got a Classic 160GB full of music, and I'm wondering if there's a tag I can put on the files in Itunes (and an option in playback on an Ipod) that would allow for me to shuffle without explicit content playing. I know that I can make playlis

  • Assets accounting error

    Hi Experts, I am getting error while configuration of assets accounting. Actually i done with all the configuration required and created 1 assets its get sucessfully created ,but getting error whild exploring the assets AWO1N "Posting period varient

  • Problem while migrating forms from 5 to 6i. Failed to load objects

    Do I need access to shcema that has all objects like tables, procedures, packages, views, etc.. used in forms during migration form 5 to 6i. I'm getting this problem. FRM-18108: Failed to load the following objects.