Sunday, June 22, 2014

Global exception handler ( in ADF

By look of it how hard it can to simply register an exception handler to capture the "unhandled ones", well it took a hell lot of my time -  nearly a week spent to figure out what was that I was doing wrong. 

To give a context - I was trying to implement the global exception handler (adf_controller_exception_handler) by extending class and putting the fully qualified name of the implemented class in .adf/META-INF/services/ file.

I saw it working in local jDeveloper (Studio Edition Version when deployed to integrated server it didn't work when deployed to dev. server. 

I banged my head a lot on this and was finally able solve it ! The issue was with the .adf/META-INF/services folder declaration - it seemed when deploying to server the exception handler was not getting registered. To debug the registered services you need to use the following.

  2.           ServiceLoader compilers = ServiceLoader.load(ExceptionHandler.class);  
  3.   ;  
  4.             for (ExceptionHandler compiler : compilers) {  
  5.       "******ExceptionHandler*********" + compiler);  
  6.             }  

If you check the loggers, the exception handler should be listed, if not then create a jar file with the exception handler class and the put the services folder along-with with the exception handler file (not a text file ) inside the META-INF of the jar file. Last step - put the jar file in WEB-INF/lib in your controller project.

No comments :

Post a Comment

your comments welcomed !