Oracle ADF Exception Handling – example

In my previous, ADF exception handling post, I have described how to catch an exception that is thrown inside a task flow. This post I am sharing about creating a custom Exception handler java class that will catch any unhandled exception thrown inside the ADF application. Using this we can catch any unhandled ADF exception, orlog the exception in a log file or delegate this exception to it successor. Basically, the custom exceptionHandler java class is extended to oracle.adf.view.rich.context.ExceptionHandler

In this example, I have created a bounded task flow with a view activity and method call activity. The view activity has a command button which calls the method action which throws a JBO exception. The exception will be caught in a custom exception class.

080916_0216_OracleADFEx1 Oracle ADF Exception Handling – example

Download the ADFExceptionHandler

Let’s begin the example,

Create a custom ExceptionHandler class

Expand the view controller and create a java class the extends oracle.adf.view.rich.context.ExceptionHandler. Override the method handleException and write the exceptional logic, logger or delegation inside the method . I have used the facesmessage to display the error in a popup

 

Register the Exception class

Open your ADF application in a file explorer, Go to .adf , META-DATA directory; Create a folder called ‘services’

080916_0216_OracleADFEx2 Oracle ADF Exception Handling – example

Go into the  ‘services’ directory and create a file called oracle.adf.view.rich.context.ExceptionHandler

080916_0216_OracleADFEx3 Oracle ADF Exception Handling – example

Now open the JDeveloper, Refresh the application; Expand Application Resources, Description, ADF META-INF and check the services directory and file we created in the previous steps are visible.

080916_0216_OracleADFEx4 Oracle ADF Exception Handling – example

Open the file Oracle.adf.view.rich.context.ExcepionHandler and input the ExceptionHandler java class

080916_0216_OracleADFEx5 Oracle ADF Exception Handling – example

That’s it. We are done with creating custom exceptional handling class and register it .if any unhandled exception rises inside the app will get caught in the registered method .

You can skip the below steps if you understand the exceptional handler.

I have created a java class called ThrowException under view controller which has one method, which throws a JBO exception. Expose the method by right click on the class and select Generate Data controller.

080916_0216_OracleADFEx6 Oracle ADF Exception Handling – example

Create a bounded task flow; Drop the exposed method from data control pallate to the task flow and drop a view activity. Using control flow case, drag a line from view to method call activity and mark it ‘toException’ as shown below. Create a JSFF page from the view activity

080916_0216_OracleADFEx7 Oracle ADF Exception Handling – example

Open the view1.jsff page and drop a command button. The action of the button should be toException

080916_0216_OracleADFEx8 Oracle ADF Exception Handling – example

Create an index.JSF page and drop the bounded task flow as a region activity; Run the page

080916_0216_OracleADFEx9 Oracle ADF Exception Handling – example

On clicking on the method will call the method ‘throwException’ method which throws a JBO exception. The exception got caught by the custom exceptionalHandler class.

080916_0216_OracleADFEx10 Oracle ADF Exception Handling – example


govindan Oracle ADF Exception Handling – example
Connect me

Govind

Thank you for visiting my personal blog. Myself Govindan, Software Developer by profession since 2006 and hence I started this blog early in 2016 and ever since I've been writing about technologies experienced and learnings of everyday life.

The views expressed on this blog are my personal views and do not necessarily reflect the views of my employer.

Please feeling free to reach me on any comments and feedbacks you have. Would be more than glad to listen and reply 🙂
govindan Oracle ADF Exception Handling – example
Connect me

6 Comments

  1. cartier like love bracelet replica December 20, 2017 at 1:52 am

    cartier like love bracelet replica

    The idiot class as you call them are being pushed and manipulated by others.

  2. bague imitation bulgari b zero December 15, 2017 at 12:21 am

    bague imitation bulgari b zero

    Good web site! I really love how it is simple on my eyes and the data are well written. I’m wondering how I could be notified when a new post has been made. I have subscribed to your feed which must do the trick! Have a nice day!

  3. 1:1 hermes kelly bolso orange December 11, 2017 at 4:03 pm

    1:1 hermes kelly bolso orange

    Talk to your health caree professional if you’ve got questions or worries about testosterone therapy.

  4. Cheap Jerseys Store December 3, 2017 at 4:57 am

    Cheap Jerseys Store

    It will provide with spray machines and hand painting. Set up new hard ware and recondition all of them with oils to make them appearance new. Within the case of iPod music downloads, you may want to do your homework and thoroughly research a web site…

  5. Trinity De Cartier Bague copie December 1, 2017 at 5:37 pm

    Trinity De Cartier Bague copie

    more or less unavailing online courses. Topics extent from selling investigate to get skin disorder. Use a form from an soul. Every causal agent should be same “implemental” in your commencement, but stay form. swan your friends as a ball performing…

  6. Vidya Gondhale November 3, 2017 at 2:08 pm

    HI Govind,

    want help to implement above logic in my current appln.
    we are using jdev 12.2.1.2.0 …my application as many functionality ..for each functionality i have created individual BTF. BTF has onpageLoad method and page fragment .page fragment has search , create operation based on requiremnt also many LOV are in it. im unable to handle uncaught exception in page fragment .everytime it gives error like this on page.

    “ADF_FACES-60097:For more information, please see the server’s error log for an entry beginning with: ADF_FACES-60096:Server Exception during PPR, #1 ”

    i tried implementing as u said in blog till ” That’s it. We are done with creating custom exceptional handling class and register it .if any unhandled exception rises inside the app will get caught in the registered method .”

    but on exception im unable to see sop in exceptionhandler class.rather still this ppr error popup out..

    can you please to implement in better way..as we have very short span for GO LIVE ..its urgent help please.

    after doing too much of hard work this error msg is giving us bad impression from client..
    thanq for understanding.

Comments are closed.

Like us on Facebook.
Connect!