2 Replies Latest reply on Feb 13, 2009 4:37 AM by nille m

    NullPointerException when using ajax4JSF

    nille m Newbie

      Hi everybody,

      I have the following problem. The following fragment is part of JSF page and works just fine.

      <t:columns value="#{WorkloadBean.columnDataModel}" var="column">
       <f:facet name="header">
       <h:panelGroup>
       <h:outputText value="#{column.calendarWeek} - #{column.calendarYear}"/>
       </h:panelGroup>
       </f:facet>
       <div align="right">
       <h:outputText value="#{WorkloadBean.columnValue}" >
       <f:convertNumber type="number" minFractionDigits="2"/>
       </h:outputText>
       <h:commandLink action="#{WorkloadBean.calculateprojectDetails}" value="go"/>
       </div>
      </t:columns>
      


      But if I change it to this (using a4j:commandLink)
      <t:columns value="#{WorkloadBean.columnDataModel}" var="column">
       <f:facet name="header">
       <h:panelGroup>
       <h:outputText value="#{column.calendarWeek} - #{column.calendarYear}"/>
       </h:panelGroup>
       </f:facet>
       <div align="right">
       <h:outputText value="#{WorkloadBean.columnValue}" >
       <f:convertNumber type="number" minFractionDigits="2"/>
       </h:outputText>
       <a4j:commandLink action="#{WorkloadBean.calculateprojectDetails}" value="go"/>
       </div>
      </t:columns>
      
      


      I get the following exception.
      2009-02-12 16:58:00,030 ERROR
      Message: "Exception in the filter chain"
      Message at: org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:181)
      
      javax.servlet.ServletException: java.lang.NullPointerException
       at javax.faces.webapp._ErrorPageWriter.throwException(_ErrorPageWriter.java:549)
       at javax.faces.webapp.FacesServlet.handleLifecycleException(FacesServlet.java:266)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:160)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:301)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
       at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
       at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390)
       at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Thread.java:619)
      Caused by: java.lang.NullPointerException
       at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:1251)
       at org.apache.myfaces.component.html.ext.AbstractHtmlSelectBooleanCheckbox.isRendered(AbstractHtmlSelectBooleanCheckbox.java:70)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:75)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:67)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:115)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:67)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:115)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:67)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:115)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:67)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:115)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:67)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:115)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:67)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:115)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:67)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:115)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:67)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:115)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:67)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:115)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:67)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:115)
       at org.ajax4jsf.renderkit.AjaxContainerRenderer.encodeAjax(AjaxContainerRenderer.java:123)
       at org.ajax4jsf.component.AjaxViewRoot.encodeAjax(AjaxViewRoot.java:677)
       at org.ajax4jsf.component.AjaxViewRoot.encodeChildren(AjaxViewRoot.java:548)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:250)
       at org.apache.myfaces.application.jsp.JspViewHandlerImpl.actuallyRenderView(JspViewHandlerImpl.java:427)
       at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:383)
       at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
       at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
       at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
       at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:155)
       ... 21 more
      

      The method "calculateprojectDetails" is but it seems that something during rendering is going wrong.

      Environment is:

      Myfaces 1.2.5
      Tomahawk 1.1.8
      Richfaces 3.3.0 GA
      Eclipse 3.4.1

      Thanks a lot in advance!

      Cheers,
      nille

        • 1. Re: NullPointerException when using ajax4JSF
          Nick Belaevski Master

          Hello Nille,

          at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:1251)
          at org.apache.myfaces.component.html.ext.AbstractHtmlSelectBooleanCheckbox.isRendered(AbstractHtmlS
          electBooleanCheckbox.java:70)

          I do not see this checkbox in the page code, that you've posted.

          • 2. Re: NullPointerException when using ajax4JSF
            nille m Newbie

            Hi nbelaevski,

            you are right, there is no checkbox on this page. But this page is part of a tabbed pane (Tomahawk) and on other tabs checkboxes are used. And by replacing the Tomahawk checkbox (t:selectBooleanCheckbox) by the 'normal' jsf/html checkbox (h:selectBooleanCheckbox) the exception is gone. So, thanks for your help (even if I don't know what the cause for this exception is).

            Regards,
            nille