Please disable your adblock and script blockers to view this page

Search this blog

Showing posts with label Exception Handler. Show all posts
Showing posts with label Exception Handler. Show all posts

Monday, 2 April 2018

PL/SQL Exceptions


An error that occurs during execution of the program is called exception, Like other programming languages, PL/SQL offers a way to catch these exceptions and handle them.

There are two types of exceptions in PL/SQL


  1. System-Defined Exceptions 
  2. User-Defined Exceptions 

Tuesday, 23 April 2013

ADFC-00024-oracle.adf.controller.ControllerException:: No ExternalContext could be found.

 ADFC-00024- No ExternalContext could be found.
this is the exception, i have faced while working on my new ADF application and due to this exception application crashed(Internal Server Error-500)
After lot of googling and searching on OTN, i found a solution for this exception- but really don't understand that how it works-
log of ADFC-00024 problem-



 oracle.adf.controller.ControllerException: ADFC-00024: No ExternalContext could be found.  
      at oracle.adfinternal.controller.util.JsfInterfaceImpl.getExternalContext(JsfInterfaceImpl.java:394)  
      at oracle.adfinternal.controller.util.JsfInterfaceImpl.getRequestMap(JsfInterfaceImpl.java:143)  
      at oracle.adfinternal.controller.state.AdfcContext.getCurrentInstance(AdfcContext.java:219)  
      at oracle.adfinternal.controller.ControllerContextImpl.getViewPortByClientId(ControllerContextImpl.java:121)  
      at oracle.adf.controller.internal.binding.DCTaskFlowBinding.getGuardingPermission(DCTaskFlowBinding.java:204)  
      at oracle.adf.model.binding.DCBindingContainer.getGuardingPermission(DCBindingContainer.java:3849)  
      at oracle.adf.model.binding.DCBindingContainer.internalIsViewable(DCBindingContainer.java:3855)  
      at oracle.adf.model.binding.DCBindingContainer.isViewable(DCBindingContainer.java:3826)  
      at oracle.adf.model.binding.DCBindingContainer.resetSuspendedExecutables(DCBindingContainer.java:3490)  
      at oracle.adf.model.binding.DCBindingContainer.resetSuspendedExecutables(DCBindingContainer.java:3492)  
      at oracle.adf.model.binding.DCBindingContainer.internalRefreshControl(DCBindingContainer.java:3365)  
      at oracle.adf.model.binding.DCBindingContainer.refresh(DCBindingContainer.java:2911)  
      at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.prepareModel(PageLifecycleImpl.java:115)  
      at oracle.adf.controller.v2.lifecycle.Lifecycle$2.execute(Lifecycle.java:149)  
      at oracle.adfinternal.controller.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:197)  
      at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener.access$400(ADFPhaseListener.java:23)  
      at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener$PhaseInvokerImpl.startPageLifecycle(ADFPhaseListener.java:238)  
      at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener$1.after(ADFPhaseListener.java:274)  
      at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener.afterPhase(ADFPhaseListener.java:75)  
      at oracle.adfinternal.controller.faces.lifecycle.ADFLifecyclePhaseListener.afterPhase(ADFLifecyclePhaseListener.java:53)  
      at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:439)  
      at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:204)  
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)  
      at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)  
      at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)  
      at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)  
      at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)  
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)  
      at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:173)  
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)  
      at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:122)  
      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)  
      at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)  
      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)  
      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)  
      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)  
      at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)  
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)  
      at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:180)  
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)  
      at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)  
      at java.security.AccessController.doPrivileged(Native Method)  
      at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)  
      at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)  
      at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)  
      at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)  
      at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)  
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)  
      at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)  
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)  
      at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)  
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)  
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)  
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)  
      at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)  
      at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)  
      at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)  
      at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)  
      at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)  
      at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)  
      at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)  

In my case this was due to Application Module configuration, in adf application we have two configuration .
  1. AMLocal
  2. AMShared
For local configuration ,in Pooling and Scalability there is Maximum Pool Size is 4096 but for shared it is only 1
i am not getting why this is so, then i have set Maximum Pool Size for shared configuration to 4096 and it is working-

Thursday, 11 April 2013

Global Exception Handler for ADF Task Flow Method Calls

Exception Handler is the central point for handling unexpected Exceptions that are thrown during the Faces lifecycle.
ADF Task Flow provides this facility, using this you can handle all exception that raised in TaskFlow methods.
here i am using ADF bounded TaskFlow with page fragments(.jsff) .
Developers must use this facility to avoid unexpected exception inside taskflows.

This is very simple approach , you have to do nothing more but create a method in Task Flow and mark it as Exception Handler and write your code inside this method , that you want to show when any exception is caught in TaskFlow.

To implement this i have implemented this scenario-

  • Create a method that throw an Exception and add it to taskFlow, and on page call this method on button click

  • public void exception() {
    throw new JboException("Failded to load");
    }
Control Flow Case in Bounded taskFlow
  • When we click on button that call exception() method ,JboException is raised inside TaskFlow and look like this- Your page crashed

  • Now create a method that will behave as ExceptionHandeler  and add it to TaskFlow and mark as Exception Handeler (Symbol in Jdev toolbar for marking)

  • public void exceptioHandeler() {
    System.out.println("Inside Handeler");
    FacesMessage message = new FacesMessage("This is custom Message for Jbo Exception-Exception Handeler");
    message.setSeverity(FacesMessage.SEVERITY_WARN);
    FacesContext fc = FacesContext.getCurrentInstance();
    fc.addMessage(null, message);

    }

Drop a method as Exception Handler in Bounded Taskflow
  • Use this sign to mark method as Exception Handeler in bounded Task Flow




There is a red icon to mark method as exception handler

  • Now Run your page and click on button that call exception() method, your page never crash, as there is handler
Customised Message appears in case of any exception in taskflow
Find Sample application Download Sample ADF Application