Forum Stats

  • 3,838,561 Users
  • 2,262,383 Discussions
  • 7,900,687 Comments

Discussions

Handle Connection Exception

Habib Eslami
Habib Eslami Member Posts: 419 Bronze Badge
edited Jun 27, 2022 11:17AM in JDeveloper and ADF

Hi dears,

I use jdev 11.1.1.7.0.

I need to handle the closed connection exception in my project, for this I've created MyErrorHandler class which extends DCErrorHandlerImpl (also updated DataBindings.cpx) and I've override the reportException() method as below :

    @Override
    public void reportException(DCBindingContainer formBnd, Exception ex) {
        String msg = "";
        JboException e = null;
        Object[] exceptions;     

        if (ex instanceof java.sql.SQLRecoverableException) {
            msg = ex.getMessage();
            if (msg.indexOf("Connection") >= 0) {
                e = new JboException("errro in connection to database ...");
                throw new JboException(e);
            } else {
                super.reportException(formBnd, ex);
            }

        } else if (ex instanceof javax.el.ELException) {
            msg = ex.getMessage();
            if (msg.indexOf("JBO-26061") >= 0) {                
                e = new JboException("errro in connection to database ...");
                throw new JboException(e);

            } else {
                super.reportException(formBnd, ex);
            }

        } else if (ex instanceof oracle.jbo.DMLException) {          
            this.reportException(formBnd, (Exception)ex.getCause());

        } else if (ex instanceof oracle.jbo.JboException) {
            exceptions = ((JboException)ex).getDetails();  
          
            if (exceptions.length > 0) {         
                for (int i = 0; i < exceptions.length; i++) {
                    this.reportException(formBnd, (Exception)exceptions[i]);
                }
            } else {               
                super.reportException(formBnd, ex);               
            }
        }
    }

when the connection is closed(in any reasons) the pop up error shows to user, which is too unclear


Is there any solution to handle this exception and then navigate to Error page or Login page.

Regards,

Habib

«13

Answers

  • dvohra21
    dvohra21 Member Posts: 14,618 Gold Crown

    As suggested, what does the server log message indicate?

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,585 Red Diamond

    Have you debugged the error handler?

    Make sure the error handler is used and caches the exception from the DB. I guess your hander is not handing the connection loss.


    Timo

  • Habib Eslami
    Habib Eslami Member Posts: 419 Bronze Badge

    Hi

    yes, the error handler caches the exception.

    I changed the reportException() to put some logs :

      @Override
      public void reportException(DCBindingContainer formBnd, Exception ex) {
    
        String msg = "";
        JboException e = null;
        Object[] exceptions;
    
        System.out.println("reportException ...........................................");
        System.out.println("excception class : " + ex.getClass());
        System.out.println("toString : " + ex.toString());
        System.out.println("getMessage : " + ex.getMessage());
    
        if (ex instanceof weblogic.jdbc.extensions.PoolDisabledSQLException) {
          msg = ex.getMessage();
          System.out.println("throw error_1");
          e = new JboException("1_error in connection to database ...");
          throw new JboException(e);
    
        } else if (ex instanceof java.sql.SQLRecoverableException) {
          msg = ex.getMessage();
    
          if (msg.indexOf("Connection") >= 0) {
            System.out.println("throw error_2");
            e = new JboException("2_error in connection to database ...");
            throw new JboException(e);
    
          } else {
            super.reportException(formBnd, ex);
          }
    
        } else if (ex instanceof javax.el.ELException) {
          msg = ex.getMessage();
    
          if (msg.indexOf("JBO-26061") >= 0) {
            System.out.println("throw error_3");
            e = new JboException("3_error in connection to database ...");
            throw new JboException(e);
    
          } else {
            super.reportException(formBnd, ex);
          }
    
        } else if (ex instanceof oracle.jbo.DMLException) {
          this.reportException(formBnd, (Exception)ex.getCause());
    
        } else if (ex instanceof oracle.jbo.JboException) {
          exceptions = ((JboException)ex).getDetails();
    
          if (exceptions.length > 0) {
            for (int i = 0; i < exceptions.length; i++) {
              this.reportException(formBnd, (Exception)exceptions[i]);
            }
    
          } else {
            super.reportException(formBnd, ex);
          }
        }
      }
    

    and the server logs :

    <ApplicationModuleImpl> <doPoolMessage> 
    oracle.jbo.JboException: JBO-29000: Unexpected exception caught: java.sql.SQLRecoverableException, msg=Connection has been administratively disabled. Try later.
    	at oracle.jbo.server.QueryCollection.setResultSetState(QueryCollection.java:5781)
    	at oracle.jbo.server.QueryCollection.disconnect(QueryCollection.java:5644)
    	at oracle.jbo.server.DBTransactionImpl.disconnect(DBTransactionImpl.java:5456)
    	at oracle.jbo.server.DBTransactionImpl2.disconnect(DBTransactionImpl2.java:371)
    	at oracle.jbo.server.DBTransactionImpl2.reconnect(DBTransactionImpl2.java:394)
    	at oracle.jbo.common.ampool.DefaultConnectionStrategy.reconnect(DefaultConnectionStrategy.java:258)
    	at oracle.jbo.server.ApplicationPoolMessageHandler.doPoolReconnect(ApplicationPoolMessageHandler.java:635)
    	at oracle.jbo.server.ApplicationPoolMessageHandler.doPoolMessage(ApplicationPoolMessageHandler.java:407)
    	at oracle.jbo.server.ApplicationModuleImpl.doPoolMessage(ApplicationModuleImpl.java:9316)
    	at oracle.jbo.common.ampool.ApplicationPoolImpl.sendPoolMessage(ApplicationPoolImpl.java:4530)
    	at oracle.jbo.common.ampool.ApplicationPoolImpl.prepareApplicationModule(ApplicationPoolImpl.java:2460)
    	at oracle.jbo.common.ampool.ApplicationPoolImpl.doCheckout(ApplicationPoolImpl.java:2270)
    	at oracle.jbo.common.ampool.ApplicationPoolImpl.useApplicationModule(ApplicationPoolImpl.java:3169)
    	at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:592)
    	at oracle.jbo.http.HttpSessionCookieImpl.useApplicationModule(HttpSessionCookieImpl.java:234)
    	at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:525)
    	at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:520)
    	at oracle.adf.model.bc4j.DCJboDataControl.initializeApplicationModule(DCJboDataControl.java:523)
    	at oracle.adf.model.bc4j.DCJboDataControl.getApplicationModule(DCJboDataControl.java:869)
    	at oracle.adf.model.binding.DCBindingContainer.findDataControl(DCBindingContainer.java:1648)
    	at oracle.adf.model.binding.DCIteratorBinding.initDataControl(DCIteratorBinding.java:2479)
    	at oracle.adf.model.binding.DCIteratorBinding.getDataControl(DCIteratorBinding.java:2423)
    	at oracle.adf.model.binding.DCIteratorBinding.refresh(DCIteratorBinding.java:4474)
    	at oracle.adf.model.binding.DCExecutableBinding.refreshIfNeeded(DCExecutableBinding.java:341)
    	at oracle.jbo.uicli.binding.JUCtrlHierNodeBinding.getChildren(JUCtrlHierNodeBinding.java:765)
    	at oracle.jbo.uicli.binding.JUCtrlHierBinding.getHintMap(JUCtrlHierBinding.java:295)
    	at oracle.jbo.uicli.binding.JUCtrlHierBinding.getHints(JUCtrlHierBinding.java:472)
    	at oracle.jbo.uicli.binding.JUCtrlValueBinding.internalGet(JUCtrlValueBinding.java:2258)
    	at oracle.jbo.uicli.binding.JUCtrlRangeBinding.internalGet(JUCtrlRangeBinding.java:548)
    	at oracle.jbo.uicli.binding.JUCtrlHierBinding.internalGet(JUCtrlHierBinding.java:457)
    	at oracle.adfinternal.view.faces.model.binding.FacesCtrlHierBinding.internalGet(FacesCtrlHierBinding.java:319)
    	at oracle.adf.model.binding.DCControlBinding.get(DCControlBinding.java:749)
    	at javax.el.MapELResolver.getValue(MapELResolver.java:164)
    	at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:173)
    	at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:200)
    	at com.sun.el.parser.AstValue.getValue(Unknown Source)
    	at com.sun.el.ValueExpressionImpl.getValue(Unknown Source)
    	at org.apache.myfaces.trinidad.bean.FacesBeanImpl.getProperty(FacesBeanImpl.java:68)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.getProperty(UIXComponentBase.java:1353)
    	at org.apache.myfaces.trinidad.component.UIXColumn.getSortProperty(UIXColumn.java:163)
    	at oracle.adfinternal.view.faces.renderkit.rich.table.BaseColumnRenderer.decodeInternal(BaseColumnRenderer.java:856)
    	at oracle.adf.view.rich.render.RichRenderer.decode(RichRenderer.java:328)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.__rendererDecode(UIXComponentBase.java:1277)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.decode(UIXComponentBase.java:790)
    	at oracle.adfinternal.view.faces.renderkit.rich.table.BaseTableRenderer.decodeColumns(BaseTableRenderer.java:1953)
    	at oracle.adfinternal.view.faces.renderkit.rich.TableRenderer.decodeInternal(TableRenderer.java:130)
    	at oracle.adf.view.rich.render.RichRenderer.decode(RichRenderer.java:328)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.__rendererDecode(UIXComponentBase.java:1277)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.decode(UIXComponentBase.java:790)
    	at org.apache.myfaces.trinidad.component.UIXTable.decode(UIXTable.java:145)
    	at org.apache.myfaces.trinidad.component.UIXCollection.processDecodes(UIXCollection.java:188)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:1059)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1045)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.processDecodes(UIXComponentBase.java:870)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:1059)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1045)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.processDecodes(UIXComponentBase.java:870)
    	at oracle.adf.view.rich.component.rich.layout.RichPanelBox.processDecodes(RichPanelBox.java:224)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:1059)
    	at oracle.adf.view.rich.component.fragment.UIXRegion.decodeChildrenImpl(UIXRegion.java:632)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1045)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.processDecodes(UIXComponentBase.java:870)
    	at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl$ApplyRequestValuesCallback.invokeContextCallback(LifecycleImpl.java:1611)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnNamingContainerComponent(UIXComponentBase.java:1517)
    	at oracle.adf.view.rich.component.fragment.UIXRegion.invokeOnComponent(UIXRegion.java:622)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1583)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    	at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.invokeOnComponent(ContextSwitchingComponent.java:194)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1583)
    	at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:720)
    	at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:678)
    	at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:720)
    	at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:678)
    	at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:720)
    	at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:678)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1583)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    	at oracle.adf.view.rich.component.fragment.UIXInclude.invokeOnComponent(UIXInclude.java:148)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1583)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1583)
    	at oracle.adf.view.rich.component.rich.RichDocument.invokeOnComponent(RichDocument.java:168)
    	at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:720)
    	at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:678)
    	at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:455)
    	at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:207)
    	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
    	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:205)
    	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    	at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:128)
    	at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    	at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
    	at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    	at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
    	at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
    	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:119)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324)
    	at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)
    	at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
    	at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
    	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:163)
    	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)
    
    
    reportException ...........................................
    excception class : class oracle.jbo.JboException
    toString : oracle.jbo.JboException: JBO-29000: Unexpected exception caught: java.sql.SQLRecoverableException, msg=Connection has been administratively disabled. Try later.
    getMessage : JBO-29000: Unexpected exception caught: java.sql.SQLRecoverableException, msg=Connection has been administratively disabled. Try later.
    reportException ...........................................
    excception class : class java.sql.SQLRecoverableException
    toString : java.sql.SQLRecoverableException: Connection has been administratively disabled. Try later.
    getMessage : Connection has been administratively disabled. Try later.
    throw error_2
    <UIXRegion> <_warn> Error processing viewId: /Bil-FldServ-flow/FldServ URI: /WEB-INF/fragments/FldServ.jsff actual-URI: /WEB-INF/fragments/FldServ.jsff.
    oracle.jbo.JboException: JBO-29000: Unexpected exception caught: oracle.jbo.JboException, msg=2_error in connection to database ...
    	at com.asr.ecs.mis.view.backing.MyErrorHandler.reportException(MyErrorHandler.java:187)
    	at com.asr.ecs.mis.view.backing.MyErrorHandler.reportException(MyErrorHandler.java:210)
    	at oracle.adf.model.binding.DCBindingContainer.reportException(DCBindingContainer.java:431)
    	at oracle.adf.model.binding.DCBindingContainer.reportException(DCBindingContainer.java:479)
    	at oracle.adf.model.binding.DCIteratorBinding.getDataControl(DCIteratorBinding.java:2445)
    	at oracle.adf.model.binding.DCIteratorBinding.refresh(DCIteratorBinding.java:4474)
    	at oracle.adf.model.binding.DCExecutableBinding.refreshIfNeeded(DCExecutableBinding.java:341)
    	at oracle.jbo.uicli.binding.JUCtrlHierNodeBinding.getChildren(JUCtrlHierNodeBinding.java:765)
    	at oracle.jbo.uicli.binding.JUCtrlHierBinding.getHintMap(JUCtrlHierBinding.java:295)
    	at oracle.jbo.uicli.binding.JUCtrlHierBinding.getHints(JUCtrlHierBinding.java:472)
    	at oracle.jbo.uicli.binding.JUCtrlValueBinding.internalGet(JUCtrlValueBinding.java:2258)
    	at oracle.jbo.uicli.binding.JUCtrlRangeBinding.internalGet(JUCtrlRangeBinding.java:548)
    	at oracle.jbo.uicli.binding.JUCtrlHierBinding.internalGet(JUCtrlHierBinding.java:457)
    	at oracle.adfinternal.view.faces.model.binding.FacesCtrlHierBinding.internalGet(FacesCtrlHierBinding.java:319)
    	at oracle.adf.model.binding.DCControlBinding.get(DCControlBinding.java:749)
    	at javax.el.MapELResolver.getValue(MapELResolver.java:164)
    	at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:173)
    	at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:200)
    	at com.sun.el.parser.AstValue.getValue(Unknown Source)
    	at com.sun.el.ValueExpressionImpl.getValue(Unknown Source)
    	at org.apache.myfaces.trinidad.bean.FacesBeanImpl.getProperty(FacesBeanImpl.java:68)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.getProperty(UIXComponentBase.java:1353)
    	at org.apache.myfaces.trinidad.component.UIXColumn.getSortProperty(UIXColumn.java:163)
    	at oracle.adfinternal.view.faces.renderkit.rich.table.BaseColumnRenderer.decodeInternal(BaseColumnRenderer.java:856)
    	at oracle.adf.view.rich.render.RichRenderer.decode(RichRenderer.java:328)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.__rendererDecode(UIXComponentBase.java:1277)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.decode(UIXComponentBase.java:790)
    	at oracle.adfinternal.view.faces.renderkit.rich.table.BaseTableRenderer.decodeColumns(BaseTableRenderer.java:1953)
    	at oracle.adfinternal.view.faces.renderkit.rich.TableRenderer.decodeInternal(TableRenderer.java:130)
    	at oracle.adf.view.rich.render.RichRenderer.decode(RichRenderer.java:328)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.__rendererDecode(UIXComponentBase.java:1277)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.decode(UIXComponentBase.java:790)
    	at org.apache.myfaces.trinidad.component.UIXTable.decode(UIXTable.java:145)
    	at org.apache.myfaces.trinidad.component.UIXCollection.processDecodes(UIXCollection.java:188)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:1059)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1045)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.processDecodes(UIXComponentBase.java:870)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:1059)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1045)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.processDecodes(UIXComponentBase.java:870)
    	at oracle.adf.view.rich.component.rich.layout.RichPanelBox.processDecodes(RichPanelBox.java:224)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:1059)
    	at oracle.adf.view.rich.component.fragment.UIXRegion.decodeChildrenImpl(UIXRegion.java:632)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1045)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.processDecodes(UIXComponentBase.java:870)
    	at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl$ApplyRequestValuesCallback.invokeContextCallback(LifecycleImpl.java:1611)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnNamingContainerComponent(UIXComponentBase.java:1517)
    	at oracle.adf.view.rich.component.fragment.UIXRegion.invokeOnComponent(UIXRegion.java:622)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1583)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    	at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.invokeOnComponent(ContextSwitchingComponent.java:194)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1583)
    
    
    Caused by: oracle.jbo.JboException: 2_error in connection to database ...
    	at com.asr.ecs.mis.view.backing.MyErrorHandler.reportException(MyErrorHandler.java:186)
    	... 111 more
    
    
    oracle.jbo.JboException: JBO-29000: Unexpected exception caught: oracle.jbo.JboException, msg=2_error in connection to database ...
    	at com.asr.ecs.mis.view.backing.MyErrorHandler.reportException(MyErrorHandler.java:187)
    	at com.asr.ecs.mis.view.backing.MyErrorHandler.reportException(MyErrorHandler.java:210)
    	at oracle.adf.model.binding.DCBindingContainer.reportException(DCBindingContainer.java:431)
    	at oracle.adf.model.binding.DCBindingContainer.reportException(DCBindingContainer.java:479)
    	at oracle.adf.model.binding.DCIteratorBinding.getDataControl(DCIteratorBinding.java:2445)
    	at oracle.adf.model.binding.DCIteratorBinding.refresh(DCIteratorBinding.java:4474)
    	at oracle.adf.model.binding.DCExecutableBinding.refreshIfNeeded(DCExecutableBinding.java:341)
    	at oracle.jbo.uicli.binding.JUCtrlHierNodeBinding.getChildren(JUCtrlHierNodeBinding.java:765)
    	at oracle.jbo.uicli.binding.JUCtrlHierBinding.getHintMap(JUCtrlHierBinding.java:295)
    	at oracle.jbo.uicli.binding.JUCtrlHierBinding.getHints(JUCtrlHierBinding.java:472)
    	at oracle.jbo.uicli.binding.JUCtrlValueBinding.internalGet(JUCtrlValueBinding.java:2258)
    	at oracle.jbo.uicli.binding.JUCtrlRangeBinding.internalGet(JUCtrlRangeBinding.java:548)
    	at oracle.jbo.uicli.binding.JUCtrlHierBinding.internalGet(JUCtrlHierBinding.java:457)
    	at oracle.adfinternal.view.faces.model.binding.FacesCtrlHierBinding.internalGet(FacesCtrlHierBinding.java:319)
    	at oracle.adf.model.binding.DCControlBinding.get(DCControlBinding.java:749)
    	at javax.el.MapELResolver.getValue(MapELResolver.java:164)
    	at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:173)
    	at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:200)
    	at com.sun.el.parser.AstValue.getValue(Unknown Source)
    	at com.sun.el.ValueExpressionImpl.getValue(Unknown Source)
    	at org.apache.myfaces.trinidad.bean.FacesBeanImpl.getProperty(FacesBeanImpl.java:68)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.getProperty(UIXComponentBase.java:1353)
    	at org.apache.myfaces.trinidad.component.UIXColumn.getSortProperty(UIXColumn.java:163)
    	at oracle.adfinternal.view.faces.renderkit.rich.table.BaseColumnRenderer.decodeInternal(BaseColumnRenderer.java:856)
    	at oracle.adf.view.rich.render.RichRenderer.decode(RichRenderer.java:328)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.__rendererDecode(UIXComponentBase.java:1277)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.decode(UIXComponentBase.java:790)
    	at oracle.adfinternal.view.faces.renderkit.rich.table.BaseTableRenderer.decodeColumns(BaseTableRenderer.java:1953)
    	at oracle.adfinternal.view.faces.renderkit.rich.TableRenderer.decodeInternal(TableRenderer.java:130)
    	at oracle.adf.view.rich.render.RichRenderer.decode(RichRenderer.java:328)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.__rendererDecode(UIXComponentBase.java:1277)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.decode(UIXComponentBase.java:790)
    	at org.apache.myfaces.trinidad.component.UIXTable.decode(UIXTable.java:145)
    	at org.apache.myfaces.trinidad.component.UIXCollection.processDecodes(UIXCollection.java:188)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:1059)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1045)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.processDecodes(UIXComponentBase.java:870)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:1059)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1045)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.processDecodes(UIXComponentBase.java:870)
    	at oracle.adf.view.rich.component.rich.layout.RichPanelBox.processDecodes(RichPanelBox.java:224)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:1059)
    	at oracle.adf.view.rich.component.fragment.UIXRegion.decodeChildrenImpl(UIXRegion.java:632)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:1045)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.processDecodes(UIXComponentBase.java:870)
    	at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl$ApplyRequestValuesCallback.invokeContextCallback(LifecycleImpl.java:1611)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnNamingContainerComponent(UIXComponentBase.java:1517)
    	at oracle.adf.view.rich.component.fragment.UIXRegion.invokeOnComponent(UIXRegion.java:622)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1583)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    	at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.invokeOnComponent(ContextSwitchingComponent.java:194)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1583)
    	at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:720)
    	at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:678)
    	at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:720)
    	at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:678)
    	at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:720)
    	at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:678)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1583)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    	at oracle.adf.view.rich.component.fragment.UIXInclude.invokeOnComponent(UIXInclude.java:148)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1583)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    	at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1583)
    	at oracle.adf.view.rich.component.rich.RichDocument.invokeOnComponent(RichDocument.java:168)
    	at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:720)
    	at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:678)
    	at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:455)
    	at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:207)
    	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
    	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:205)
    	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    	at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:128)
    	at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    	at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
    	at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    	at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
    
    
    Caused by: oracle.jbo.JboException: 2_error in connection to database ...
    	at com.asr.ecs.mis.view.backing.MyErrorHandler.reportException(MyErrorHandler.java:186)
    	... 111 more
    
    
    reportException ...........................................
    excception class : class oracle.jbo.DMLException
    toString : oracle.jbo.DMLException: JBO-26061: Error while opening JDBC connection.
    getMessage : JBO-26061: Error while opening JDBC connection.
    reportException ...........................................
    excception class : class weblogic.jdbc.extensions.PoolDisabledSQLException
    toString : weblogic.jdbc.extensions.PoolDisabledSQLException: weblogic.common.resourcepool.ResourceDisabledException: Data Source CmnEmis is not active, cannot allocate connections to applications
    getMessage : weblogic.common.resourcepool.ResourceDisabledException: Data Source CmnEmis is not active, cannot allocate connections to applications
    throw error_1
    <AdfcExceptionHandler> <handleException> ADFc: No exception handler was found for an application exception.
    javax.faces.FacesException: javax.servlet.ServletException: OracleJSP error:
    oracle.jbo.JboException: JBO-29000: Unexpected exception caught: oracle.jbo.JboException, msg=1_error in connection to database ...
    	at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:415)
    	at org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch(ExternalContextDecorator.java:44)
    	at org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch(ExternalContextDecorator.java:44)
    	at org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch(ExternalContextDecorator.java:44)
    	at oracle.adfinternal.view.faces.config.rich.RecordRequestAttributesDuringDispatch.dispatch(RecordRequestAttributesDuringDispatch.java:44)
    	at org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch(ExternalContextDecorator.java:44)
    	at org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch(ExternalContextDecorator.java:44)
    	at org.apache.myfaces.trinidadinternal.context.FacesContextFactoryImpl$OverrideDispatch.dispatch(FacesContextFactoryImpl.java:267)
    	at com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:469)
    	at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:140)
    	at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:189)
    	at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:193)
    	at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._renderResponse(LifecycleImpl.java:979)
    	at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:408)
    	at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:237)
    	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
    	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:205)
    	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    	at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:128)
    
    
    Caused by: oracle.jbo.JboException: 1_error in connection to database ...
    	at com.asr.ecs.mis.view.backing.MyErrorHandler.reportException(MyErrorHandler.java:179)
    	... 159 more
    
    
    
    

    Regards,

    Habib

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,585 Red Diamond

    Yes, but you only rethrow the error. Check the old sample for the article 'Catch me if you can' from an old ORacle Magazin https://community.oracle.com/tech/developers/discussion/4494822/exception-handler-for-oracle-adf-application

    The article itself is offline currently. You need to change the exception handler of the view layer too.


    Timo

  • dvohra21
    dvohra21 Member Posts: 14,618 Gold Crown
    edited Jun 29, 2022 2:16AM

    What is the weblogic server version? A known issue does exist:

    Troubleshooting java.sql.SQLException: "Connection has been administratively disabled. Try later" (Doc ID 1211143.1)

  • Habib Eslami
    Habib Eslami Member Posts: 419 Bronze Badge

    Hi

    What is the weblogic server version? A known issue does exist:

    Troubleshooting java.sql.SQLException: "Connection has been administratively disabled. Try later" (Doc ID 1211143.1)

    I use jdev 11.1.1.7.0 and weblogic server 11g 10.3.6.0.

    I do myself shutdown the connection in weblogic to check how I can handle the exception.

    Regards,

    Habib

  • dvohra21
    dvohra21 Member Posts: 14,618 Gold Crown

    The known issue is with Oracle WebLogic Server - Version 10.0 to 10.3. A java.sql.SQLRecoverableException is recoverable and not meant to be handled and rethrown other than may be to provide an easier-to-understand and descriptive message.

    public class SQLRecoverableException
    extends SQLException
    

    The subclass of SQLException thrown in situations where a previously failed operation might be able to succeed if the application performs some recovery steps and retries the entire transaction or in the case of a distributed transaction, the transaction branch. At a minimum, the recovery operation must include closing the current connection and getting a new connection.

  • Habib Eslami
    Habib Eslami Member Posts: 419 Bronze Badge
    edited Jun 30, 2022 8:39AM

    I've added logout() method and called it from reportException()

    private void logout() {
        try {
            FacesContext fctx = FacesContext.getCurrentInstance();
            ExternalContext ectx = fctx.getExternalContext();
    
            HttpServletRequest request = (HttpServletRequest)ectx.getRequest();
            HttpServletResponse response = (HttpServletResponse)ectx.getResponse();
            response.sendRedirect(request.getContextPath() + request.getServletPath() + "/Login.jspx");
    
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    

    when this method is called, nothing happens and the control doesn't navigate to login page and still shows the popup error (for closed connection).

    Regards,

    Habib

  • dvohra21
    dvohra21 Member Posts: 14,618 Gold Crown

    The reportException method does not call the logout() method in sample listed. Please list the call to logout:

    else if (ex instanceof java.sql.SQLRecoverableException) {
          msg = ex.getMessage();
    
          if (msg.indexOf("Connection") >= 0) {
            System.out.println("throw error_2");
            e = new JboException("2_error in connection to database ...");
            throw new JboException(e);
    
          } else {
            super.reportException(formBnd, ex);
          }
    
        }
    

    Moreover, if logout() is added after some exception messages are output, the logout() may not get called.

  • Habib Eslami
    Habib Eslami Member Posts: 419 Bronze Badge
    edited Jun 30, 2022 3:07PM

    The reportException method does not call the logout() method in sample listed. Please list the call to logout:

    Hi

    I've added the logou() method into reportException() as follows :

      @Override
        public void reportException(DCBindingContainer formBnd, Exception ex) {
            String msg = "";
            JboException e = null;
            Object[] exceptions;     
    
            if (ex instanceof java.sql.SQLRecoverableException) {
                msg = ex.getMessage();
                if (msg.indexOf("Connection") >= 0) {
    
                    logou();
    
                    //e = new JboException("errro in connection to database ...");                
                    //throw new JboException(e);
                } else {
                    super.reportException(formBnd, ex);
                }
    
            } else if (ex instanceof javax.el.ELException) {
                msg = ex.getMessage();
                if (msg.indexOf("JBO-26061") >= 0) {     
                
                      logou();           
                    //e = new JboException("errro in connection to database ...");
                    //throw new JboException(e);
    
                } else {
                    super.reportException(formBnd, ex);
                }
    
            } else if (ex instanceof oracle.jbo.DMLException) {          
                this.reportException(formBnd, (Exception)ex.getCause());
    
            } else if (ex instanceof oracle.jbo.JboException) {
                exceptions = ((JboException)ex).getDetails();  
              
                if (exceptions.length > 0) {         
                    for (int i = 0; i < exceptions.length; i++) {
                        this.reportException(formBnd, (Exception)exceptions[i]);
                    }
                } else {               
                    super.reportException(formBnd, ex);               
                }
            }
        }
    

    Regards,

    Habib