2 Replies Latest reply on Jul 21, 2007 3:27 AM by mcrob427

    NullPointerException at a4j:include

    mcrob427

      Hi, I'm sorry for repeatedly posting about a4j:include, but I keep running into these problems that nobody seems to have seen before.

      I ran into NPE while clicking on an a4j:commandButton inside the included page (using a4j:include). Here's the stack trace -

      SEVERE: Servlet.service() for servlet jsp threw exception
      java.lang.NullPointerException
       at javax.faces.component.UIComponentBase$ChildrenList.remove(UIComponentBase.java:1567)
       at javax.faces.webapp.UIComponentTag.removeOldChildren(UIComponentTag.java:1205)
       at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:557)
       at org.ajax4jsf.taglib.html.jsp.IncludeTag.doEndTag(IncludeTag.java:176)
       at org.apache.jsp.reports.TestMain_jsp._jspx_meth_a4j_include_0(TestMain_jsp.java:190)
       at org.apache.jsp.reports.TestMain_jsp._jspx_meth_h_panelGroup_0(TestMain_jsp.java:166)
       at org.apache.jsp.reports.TestMain_jsp._jspx_meth_h_form_0(TestMain_jsp.java:139)
       at org.apache.jsp.reports.TestMain_jsp._jspx_meth_f_view_0(TestMain_jsp.java:106)
       at org.apache.jsp.reports.TestMain_jsp._jspService(TestMain_jsp.java:70)
       at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
       at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
       at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
       at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at com.bluejungle.destiny.webui.framework.loginmgr.LoginFilterImpl.doFilter(LoginFilterImpl.java:125)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
       at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
       at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
       at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
       at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:346)
       at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:152)
       at com.bluejungle.destiny.webui.framework.faces.RequestParameterAllowingViewHandler.renderView(RequestParameterAllowingViewHandler.java:104)
       at com.bluejungle.destiny.webui.framework.faces.PrerenderActionViewHandler.renderView(PrerenderActionViewHandler.java:152)
       at com.bluejungle.destiny.webui.framework.faces.CompoundCustomViewHandler.renderView(CompoundCustomViewHandler.java:81)
       at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
       at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:233)
       at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:107)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
       at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:137)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:214)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at com.bluejungle.destiny.webui.framework.loginmgr.LoginFilterImpl.doFilter(LoginFilterImpl.java:125)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
       at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
       at java.lang.Thread.run(Thread.java:595)
      


      The command button click generates two FacesServlet requests, the first one is the actual command button request, and the second one is a request for the targeted include page to re-render. However it seems that in the Render View phase of the second request, while the doEndTag() method is called for the IncludeTag, something called removeOldChildren() will be called, which will attemp to remove all of the children of the old include page, but by this point, the child are all gone already, hence a NPE is thrown.

      I stepped through the code everywhere and I'm really confused as to why this is happening. If anybody has seen this, any help would be greatly appreciated.

      Robert

        • 1. Re: NullPointerException at a4j:include

          what you have on the page? why "
          The command button click generates two FacesServlet requests"?

          • 2. Re: NullPointerException at a4j:include
            mcrob427

            Thanks for the reply Sergey. I was actually just running the demo for a4j:include, and I get this behavior. Apparantly the first request handles the actual command button click, and the second request is a forward request to the targeted include page. I have no clue why that is.

            However, I've given up on trying to solve this and I'm going to just use a workaround. Since all other a4j components work fine for me, I'm just going to use a couple of a4j:include tags with the "rendered" attribute set to two separate properties inside a managed bean. And when I click on the command button, the action listener binding will go and set the values for the managed bean properties and reload the h:panelGroup that has the a4j:include.

            Thanks.