1 Reply Latest reply on May 1, 2008 4:46 PM by Stan Silvert

    NullPointerException with clickPanelMenuItem

    Adrien Adrien Apprentice

      I have a NPE(see and of this message) with jsfunitbeta2 and clickPanelMenuItem.

      The result is different if the name of the form is change.
      In the sample the name is
      if i change to
      The the test is false without npe
      ajaxClient.clickPanelMenuItem("Item_1_1");
      ajaxClient.clickPanelMenuItem("Aform:Item_1_1");

      Anybody have this problem?

      ajaxClient.clickPanelMenuItem("Item_1_1");

      -----------------backing bean------------------------
      public final String searchx() {
      return "msg_rec";
      }

      ----------------------------face config--------------------------------


      <navigation-case>
      <from-outcome>msg_rec</from-outcome>
      <to-view-id>/pages/m/msgresult.jsp</to-view-id>
      </navigation-case>

      ----------------------------------JSP-------------------------------
      <%@ include file="/WEB-INF/jspf/taglibs.jsp"%>


      <%@ include file="/WEB-INF/jspf/commons/metas.jsp"%>

      <%@ include file="/WEB-INF/jspf/commons/css.jsp"%>
      t



      <f:view>
      <h:form id="form">
      <h:panelGrid columns="2" columnClasses="cols" width="100%">
      <rich:panelMenu id="ajaxPanelMenu" style="width:200px" mode="ajax"
      >
      <rich:panelMenuGroup id="Group1" label="Group 1">
      <rich:panelMenuItem id="Item_1_1" label="Item 1.1" action="#{ctrlMessagesSearch.searchx}">
      <f:param name="current" value="Item 1.1"/>
      </rich:panelMenuItem>
      <rich:panelMenuItem id="Item_1_2" label="Item 1.2" action="#{ctrlMessagesSearch.searchx}">
      <f:param name="current" value="Item 1.2"/>
      </rich:panelMenuItem>
      <rich:panelMenuItem id="Item_1_3" label="Item 1.3" action="#{ctrlMessagesSearch.searchx}">
      <f:param name="current" value="Item 1.3"/>
      </rich:panelMenuItem>
      </rich:panelMenuGroup>
      <rich:panelMenuGroup id="Group2" label="Group 2">
      <rich:panelMenuItem id="Item_2_1" label="Item 2.1" action="#{ctrlMessagesSearch.searchx}">
      <f:param name="current" value="Item 2.1"/>
      </rich:panelMenuItem>
      <rich:panelMenuItem id="Item_2_2" label="Item 2.2" action="#{ctrlMessagesSearch.searchx}">
      <f:param name="current" value="Item 2.2"/>
      </rich:panelMenuItem>
      <rich:panelMenuItem id="Item_2_3" label="Item 2.3" action="#{ctrlMessagesSearch.searchx}">
      <f:param name="current" value="Item 2.3"/>
      </rich:panelMenuItem>
      <rich:panelMenuGroup label="Group 2.4">
      <rich:panelMenuItem id="Item_2_4_1" label="Item 2.4.1" action="#{ctrlMessagesSearch.searchx}">
      <f:param name="current" value="Item 2.4.1"/>
      </rich:panelMenuItem>
      <rich:panelMenuItem id="Item_2_4_2" label="Item 2.4.2" action="#{ctrlMessagesSearch.searchx}">
      <f:param name="current" value="Item 2.4.2"/>
      </rich:panelMenuItem>
      <rich:panelMenuItem id="Item_2_4_3" label="Item 2.4.3" action="#{ctrlMessagesSearch.searchx}">
      <f:param name="current" value="Item 2.4.3"/>
      </rich:panelMenuItem>
      </rich:panelMenuGroup>
      <rich:panelMenuItem id="Item_2_5" label="Item 2.5" action="#{ctrlMessagesSearch.searchx}">
      <f:param name="current" value="Item 2.5"/>
      </rich:panelMenuItem>
      </rich:panelMenuGroup>
      <rich:panelMenuGroup id="Group3" label="Group 3">
      <rich:panelMenuItem id="Item_3_1" label="Item 3.1" action="#{ctrlMessagesSearch.searchx}">
      <f:param name="current" value="Item 3.1"/>
      </rich:panelMenuItem>
      <rich:panelMenuItem id="Item_3_2" label="Item 3.2" action="#{ctrlMessagesSearch.searchx}">
      <f:param name="current" value="Item 3.2"/>
      </rich:panelMenuItem>
      <rich:panelMenuItem id="Item_3_3" label="Item 3.3" action="#{ctrlMessagesSearch.searchx}">
      <f:param name="current" value="Item 3.3"/>
      </rich:panelMenuItem>
      </rich:panelMenuGroup>
      </rich:panelMenu>
      <rich:panel>
      <a4j:outputPanel ajaxRendered="true">
      <h:outputText value="#{panelMenu.current} selected" id="current"/>
      </a4j:outputPanel>
      </rich:panel>
      </h:panelGrid>
      </h:form>

      </f:view>







      -------------------------------------STACK TRACE---------------------------------
      java.lang.NullPointerException
      at org.jboss.jsfunit.richfaces.JSFAJAX.processResponse(JSFAJAX.java:84)
      at org.jboss.jsfunit.richfaces.Ajax4jsfClient.doAjaxRequest(Ajax4jsfClient.java:192)
      at org.jboss.jsfunit.richfaces.Ajax4jsfClient.ajaxSubmit(Ajax4jsfClient.java:179)
      at org.jboss.jsfunit.richfaces.RichFacesClient.clickPanelMenuItem(RichFacesClient.java:279)
      at com.horizon.web.jsf.searches.msgs.CtrlMessagesSearchesBeanTest.testAjaxModePanelMenu(CtrlMessagesSearchesBeanTest.java:90)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at junit.framework.TestCase.runTest(TestCase.java:154)
      at junit.framework.TestCase.runBare(TestCase.java:127)
      at org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(AbstractCactusTestCase.java:153)
      at org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.java:119)
      at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody0(AbstractWebTestController.java:93)
      at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody1$advice(AbstractWebTestController.java:224)
      at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest(AbstractWebTestController.java)
      at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(ServletTestRedirector.java:101)
      at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$advice(ServletTestRedirector.java:224)
      at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java)
      at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(ServletTestRedirector.java:72)
      at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advice(ServletTestRedirector.java:224)
      at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.jboss.jsfunit.framework.JSFUnitFilter.doFilter(JSFUnitFilter.java:122)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      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:230)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
      at java.lang.Thread.run(Thread.java:619)

        • 1. Re: NullPointerException with clickPanelMenuItem
          Stan Silvert Master

          That's quite odd. I can't think of a reason why the name of the form would matter unless JSF doesn't like it.

          I'm switching the JSFClientSession to use HtmlUnit instead of HttpUnit. So far it is a HUGE improvement. It handles javascript a lot better which should mean complete support for RichFaces and other AJAX libraries. So I'm betting that your problem will go away.

          I'm going to release a snapshot version that uses HtmlUnit as soon as possible. Stay tuned.

          Stan