9 Replies Latest reply on Oct 27, 2010 3:13 PM by 808415

    Null pointer exception while Lov based PPR event fire

    808415
      Hello everyone,
      I hav a lov with 3 different values.when lov is selected a PPR event is fired which make an item as required and another item as rendered. I hav two methods in the Application module : one for initialising the application properties VO and another for handling the lov change event:

      public void initialisePPRVO() {
      OAViewObject appPropsVO =
      (OAViewObject)findViewObject("AppPropertyVO1");
      if (appPropsVO != null)
      {
      if (appPropsVO.getFetchedRowCount() == 0)
      {
      appPropsVO.setMaxFetchSize(0);
      appPropsVO.executeQuery();
      Row row = appPropsVO.createRow();
      appPropsVO.insertRow(row);
      row = (OARow)appPropsVO.first();
      row.setAttribute("RowKey", new Number(1));
      }
      }

      public void handlePCardAcceptanceChangeEvent()
      {
      OAViewObject vo = (OAViewObject)findViewObject("AppPropertyVO1");
      OARow row = (OARow)vo.first();
      OAViewObject poVO = (OAViewObject)findViewObject("PcardAcceptanceLevelLOVVO1");
      OARow poRow = (OARow)poVO.getCurrentRow();
      String status = (String)poRow.getAttribute("FlexValue");
      // Set the application property values based on the PO Approval status value.
      if ("0".equals(status))
      {
      row.setAttribute("GhostPCardNumberRequired", "no");
      row.setAttribute("AribaNetworkIdRendered", Boolean.FALSE);
      }
      else if (("1".equals(status))||("2".equals(status)))
      {
      row.setAttribute("GhostPCardNumberRequired", "yes");
      row.setAttribute("AribaNetworkIdRendered", Boolean.TRUE);


      }

      } // end handlePCardAcceptanceChangeEvent()

      And I have also written the controller code as follows :

      public void processRequest(OAPageContext pageContext, OAWebBean webBean)
      {
      super.processRequest(pageContext, webBean);

      AribaAMImpl aribaAM = new AribaAMImpl();
      aribaAM.initialisePPRVO();
      }

      public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
      {
      super.processFormRequest(pageContext, webBean);
      AribaAMImpl aribaAM = new AribaAMImpl();
      String event = pageContext.getParameter("event");
      if (pageContext.isLovEvent())
      {
      String lovInputSourceId = pageContext.getLovInputSourceId();
      if ("PcardAcceptanceLevel".equals(lovInputSourceId)) // PcardAcceptanceLevel is the ID of lov item
      {
      aribaAM.handlePCardAcceptanceChangeEvent();

      }
      }
      }
      But when Im running the code it is giving me null pointer exception as follows :

      Exception Details.
      oracle.apps.fnd.framework.OAException: java.lang.NullPointerException
           at oracle.apps.fnd.framework.OAException.wrapperException(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAPageErrorHandler.processErrors(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
           at OA.jspService(_OA.java:71)
           at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
           at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
           at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
           at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
           at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
           at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
           at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
           at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
           at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
           at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
           at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
           at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
           at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
           at java.lang.Thread.run(Thread.java:595)
      ## Detail 0 ##
      java.lang.NullPointerException
           at oracle.apps.ak.AEAPCNTS.Server.AribaAMImpl.handlePCardAcceptanceChangeEvent(AribaAMImpl.java:74)
           at oracle.apps.ak.AEAPCNTS.webui.AribaCO.processFormRequest(AribaCO.java:73)
           at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(Unknown Source)
           at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
           at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
           at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
           at OA.jspService(_OA.java:71)
           at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
           at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
           at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
           at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
           at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
           at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
           at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
           at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
           at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
           at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
           at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
           at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
           at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
           at java.lang.Thread.run(Thread.java:595)
      java.lang.NullPointerException
           at oracle.apps.ak.AEAPCNTS.Server.AribaAMImpl.handlePCardAcceptanceChangeEvent(AribaAMImpl.java:74)
           at oracle.apps.ak.AEAPCNTS.webui.AribaCO.processFormRequest(AribaCO.java:73)
           at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(Unknown Source)
           at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
           at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
           at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
           at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
           at OA.jspService(_OA.java:71)
           at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
           at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
           at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
           at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
           at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
           at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
           at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
           at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
           at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
           at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
           at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
           at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
           at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
           at java.lang.Thread.run(Thread.java:595)

      Can anyone tell me why is this happening. as I'm a beginner in oaf so I have recently learnt PPR.
        • 1. Re: Null pointer exception while Lov based PPR event fire
          AnilSharma
          Welcome to forums :)

          Paste the AM code at Line No 74.
          AribaAMImpl.java:74
          Thanks
          --Anil
          http://oracleanil.blogspot.com
          1 person found this helpful
          • 2. Re: Null pointer exception while Lov based PPR event fire
            ORA_AJ
            Aryan

            Modify your AM code handlePCardAcceptanceChangeEvent method like mentioned below & run the page again.
            public void handlePCardAcceptanceChangeEvent()
            {
            OAViewObject vo = (OAViewObject)findViewObject("AppPropertyVO1");
            OARow row = (OARow)vo.first();
            OAViewObject poVO = (OAViewObject)findViewObject("PcardAcceptanceLevelLOVVO1");
            poVO.first();
            OARow poRow = (OARow)poVO.getCurrentRow();
            String status = (String)poRow.getAttribute("FlexValue");
            // Set the application property values based on the PO Approval status value.
            if ("0".equals(status))
            {
            row.setAttribute("GhostPCardNumberRequired", "no");
            row.setAttribute("AribaNetworkIdRendered", Boolean.FALSE);
            }
            else if (("1".equals(status))||("2".equals(status)))
            {
            row.setAttribute("GhostPCardNumberRequired", "yes");
            row.setAttribute("AribaNetworkIdRendered", Boolean.TRUE);
            
            }
            Thanks
            AJ
            • 3. Re: Null pointer exception while Lov based PPR event fire
              808415
              Anil,
              Thanks for the reply. But I couldn't get ur suggestion that "Paste the AM code at Line No 74." Can u tell me which AM code?
              • 4. Re: Null pointer exception while Lov based PPR event fire
                ORA_AJ
                Aryan_Raiz wrote:
                Anil,
                Thanks for the reply. But I couldn't get ur suggestion that "Paste the AM code at Line No 74." Can u tell me which AM code?
                What Anil meant is in your AMImpl go to line No 74 , copy and paste that code here.


                Have you tried my solution???



                Thanks
                AJ
                1 person found this helpful
                • 5. Re: Null pointer exception while Lov based PPR event fire
                  808415
                  Hi AJ,
                  Thanks for reply.
                  But its still showing the same error.
                  • 6. Re: Null pointer exception while Lov based PPR event fire
                    ORA_AJ
                    Then paste your whole AMImpl file as it is along with error stack once again.

                    Thanks
                    AJ
                    1 person found this helpful
                    • 7. Re: Null pointer exception while Lov based PPR event fire
                      808415
                      I again got the same error .
                      While debugging the code I found out that the instance of Application Propertis VO (AppPropertyVO1) is not getting created in initialisePPRVO() of AMImpl. And its not going inside the if condition.
                      Im pasting the AMImpl file :

                      package oracle.apps.ak.AEAPCNTS.Server;

                      import com.sun.java.util.collections.ArrayList;
                      import oracle.apps.fnd.framework.OAException;
                      import oracle.apps.fnd.framework.OARow;
                      import oracle.apps.fnd.framework.OAViewObject;
                      import oracle.apps.fnd.framework.server.OAApplicationModuleImpl;
                      import oracle.apps.fnd.framework.server.OAViewObjectImpl;
                      import oracle.jbo.Row;
                      import oracle.jbo.domain.Number;

                      // ---------------------------------------------------------------------
                      // --- File generated by Oracle ADF Business Components Design Time.
                      // --- Custom code may be added to this class.
                      // --- Warning: Do not modify method signatures of generated methods.
                      // ---------------------------------------------------------------------
                      public class AribaAMImpl extends OAApplicationModuleImpl {
                      /**This is the default constructor (do not remove)
                      */
                      public AribaAMImpl() {
                      }


                      /**Sample main for debugging Business Components code using the tester.
                      */
                      public static void main(String[] args) {
                      launchTester("oracle.apps.ak.AEAPCNTS.Server", /* package name */
                      "AribaAMLocal" /* Configuration Name */);
                      }
                      public void initialisePPRVO() {
                      // Create purchase order header

                      OAViewObject appPropsVO =
                      (OAViewObject)this.findViewObject("AppPropertyVO1");
                      if (appPropsVO != null) *// Here the appPropsVO is null  which means that AppPropertyVO is not getting instantiated* {
                      appPropsVO.setMaxFetchSize(0);
                      appPropsVO.executeQuery();
                      Row row = appPropsVO.createRow();
                      appPropsVO.insertRow(row);

                      row = (OARow)appPropsVO.first();
                      row.setAttribute("RowKey", new Number(1));
                      System.out.println("inside aribaAMimpl.initializePRVO1");
                      }
                      handlePCardAcceptanceChangeEvent(); *// AribaAMImpl.java:46*
                      System.out.println("inside aribaAMimpl.initializePRVO2");
                      }


                      public void handlePCardAcceptanceChangeEvent()
                      {
                      System.out.println("inside handlePCardAcceptanceChangeEvent() status");

                      OAViewObject vo = (OAViewObject)this.findViewObject("AppPropertyVO1");
                      OARow row = (OARow)vo.first(); *// AribaAMImpl.java:56*

                      OAViewObject poVO = (OAViewObject)this.findViewObject("PcardAcceptanceLevelLOVVO1");
                      poVO.first();
                      OARow poRow = (OARow)poVO.getCurrentRow();
                      String status = (String)poRow.getAttribute("FlexValue");
                      // Set the application property values based on the PO Approval status value.
                      if ("0".equals(status))
                      {
                      row.setAttribute("GhostPCardNumberRequired", "no");
                      row.setAttribute("AribaNetworkIdRendered", Boolean.FALSE);
                      }
                      else if (("1".equals(status))||("2".equals(status)))
                      {
                      row.setAttribute("GhostPCardNumberRequired", "yes");
                      row.setAttribute("AribaNetworkIdRendered", Boolean.TRUE);


                      } // end handlePCardAcceptanceChangeEvent()
                      }

                      /**Container's getter for PcardAcceptanceLevelLOVVO1
                      */
                      public OAViewObjectImpl getPcardAcceptanceLevelLOVVO1() {
                      return (OAViewObjectImpl)this.findViewObject("PcardAcceptanceLevelLOVVO1");
                      }

                      /**Container's getter for AppPropertyVO1
                      */
                      public OAViewObjectImpl getAppPropertyVO1() {
                      return (OAViewObjectImpl)this.findViewObject("AppPropertyVO1");
                      }
                      }


                      And Controller goes as:

                      public void processRequest(OAPageContext pageContext, OAWebBean webBean)
                      {
                      super.processRequest(pageContext, webBean);

                      System.out.println("inside controller processrequest");

                      AribaAMImpl aribaAM = new AribaAMImpl();
                      aribaAM.initialisePPRVO(); *// AribaCO.java:45*
                      /* OAApplicationModule am =
                      (OAApplicationModule)pageContext.getApplicationModule(webBean);
                      am.invokeMethod("initialisePPRVO");*/ I have tried creating instance of AM this way also. but same error
                      }

                      public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
                      {
                      super.processFormRequest(pageContext, webBean);
                      AribaAMImpl aribaAM = new AribaAMImpl();
                      String event = pageContext.getParameter("event");

                      System.out.println("inside controller processformrequestprocessformrequest");
                      if (pageContext.isLovEvent())
                      {
                      System.out.println("inside lov if"); // for debugging purpose only

                      String lovInputSourceId = pageContext.getLovInputSourceId();
                      System.out.println("inside lov if-"+lovInputSourceId);
                      if ("PcardAcceptanceLevel".equals(lovInputSourceId))
                      {
                      //am.invokeMethod("handlePCardAcceptanceChangeEvent");
                      aribaAM.handlePCardAcceptanceChangeEvent();
                      System.out.println("inside lov if End");

                      }
                      }
                      }

                      And i got null pointer exeception at : ( Also specified above in the code )
                      => AribaAMImpl.java:56 whic is : OARow row = (OARow)vo.first();
                      => AribaAMImpl.java:46 : handlePCardAcceptanceChangeEvent(); // call in initialisePPR?VO()
                      => AribaCO.java:45 : aribaAM.initialisePPRVO();


                      Plz help...

                      Edited by: Aryan_Raiz on Oct 27, 2010 7:21 AM
                      • 8. Re: Null pointer exception while Lov based PPR event fire
                        781651
                        Hi,

                        1) In your controller code
                        AribaAMImpl aribaAM = new AribaAMImpl();
                        aribaAM.initialisePPRVO(); // AribaCO.java:45
                        You should not initialize AM like this. Your earlier approach was fine.
                        i.e.
                        OAApplicationModule am = (OAApplicationModule)pageContext.getApplicationModule(webBean);
                        if(am != null)
                        {
                        am.invokeMethod("initialisePPRVO");
                        }
                        You said you are getting null pointer at for this code. Check whether you have attached AM in pageContext region of the page.

                        2) In your AM code
                        handlePCardAcceptanceChangeEvent(); **// AribaAMImpl.java:46**
                        System.out.println("inside aribaAMimpl.initializePRVO2");
                        call method "handlePCardAcceptanceChangeEvent()" from CO iteself.
                        i.e.
                        OAApplicationModule am = (OAApplicationModule)pageContext.getApplicationModule(webBean);
                        if(am != null)
                        {
                        am.invokeMethod("initialisePPRVO");
                        am.invokeMethod("handlePCardAcceptanceChangeEvent");
                        
                        }
                        3) In your AM code, instead of the code
                        OAViewObject vo = (OAViewObject)this.findViewObject("AppPropertyVO1");
                        OARow row = (OARow)vo.first(); // AribaAMImpl.java:56
                        use
                        OAViewObjectImpl vo = getAppPropertyVO1();
                        if(vo != null)
                        {
                        Row row = vo.first();
                        if(row != null)
                        {
                        // your code here
                        }
                        }
                        -Anand
                        • 9. Re: Null pointer exception while Lov based PPR event fire
                          808415
                          Hey Anand ,Thanks a loads.. yar It worked.. I'm so happy...

                          N thanks everybody for ur replies and sparing out time for that...
                          Thanks again..Will bother u soon again... :)