7 Replies Latest reply on Jun 11, 2007 7:45 AM by Ilya Shaikovsky

    Ajax4JSF "cannot be cast" problem

    Jack Foster Newbie

      I just tried to install the simple ajax4jsf refresh test on one of my already working jsf pages.

      <a4j:region id="stat1">
       <h:inputText>
       <a4j:support action="#{nameBean.DelayAct}" event="onkeyup" />
       </h:inputText>
       <a4j:status startText=" Performing Request" stopText=" Request Done" for="stat1" />
       </a4j:region>


      When I type in the box, it shows "Performing Request" but comes up with a "500 Internal Server Error. Message: NULL"

      So I checked the log and saw this:
      org.apache.catalina.core.StandardHostValve custom SEVERE: Exception Processing ErrorPage[exceptionType=java.lang.Exception, location=/serverError.jsf]
      javax.servlet.ServletException: com.sun.faces.extensions.avatar.components.PartialTraversalViewRootImpl cannot be cast to com.sun.faces.application.StateManagerImpl$TreeNode
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
      icationFilterChain.java:290)


      I know it's a shot in the dark but I'm stuck here as I have no idea where to go. Is something conflicting?

        • 1. Re: Ajax4JSF
          Jack Foster Newbie

          Forgot to mention. This code was taken from: http://livedemo.exadel.com/a4j-status/

          • 2. Re: Ajax4JSF
            Jack Foster Newbie

            I guess it was complaining as the nameBean did not exist. Once I took that entire action out, it just reloaded the entire page but at least it didn't complain.

            I know this probably quite a newbie question, but if I wanted to implement this, I would have to make a nameBean managed bean and implement the DelayAct function? What would it do?

            • 3. Re: Ajax4JSF
              Ilya Shaikovsky Master

              you need just took the page and the bean from the example and register the bean in your web.xml

              • 4. Re: Ajax4JSF
                Jack Foster Newbie

                Thanks for your reply. However I don't see the bean on the example page. Am I missing something?

                • 5. Re: Ajax4JSF
                  Jack Foster Newbie

                  Well.. I've played with it more and got rid of the Nullpointer exception in the browser by changing the STATE_SAVE to server instead of client. So now the code on the page will render, but get cut off:

                  </tr>
                  </tbody>
                  </table>
                  </td>
                  </tr>
                  <tr>
                  <td><input type="text" name="demo:content:j_id_jsp_787202587_15pc8" value=""
                  


                  in the logs it says:
                  Jun 8, 2007 3:23:38 PM org.apache.catalina.core.StandardWrapperValve invoke
                  INFO: Jun 8, 2007 3:23:38 PM com.sun.faces.lifecycle.LifecycleImpl phase
                  WARNING: executePhase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl@110195c) threw exception
                  javax.faces.FacesException: javax.el.ELException: java.lang.NullPointerException
                  at javax.faces.component.UIComponentBase$AttributesMap.get(UIComponentBase.java:1550) at com.sun.faces.renderkit.RenderKitUtils.renderPassThruAttributes(RenderKitUtils.java:440)
                  ...
                  Caused by: javax.el.ELException: java.lang.NullPointerException
                  at javax.faces.component.ValueExpressionValueBindingAdapter.getValue(ValueExpressionValueBindingAdapte
                  r.java:76)
                  at javax.faces.component.html.HtmlInputText.getOnkeyup(HtmlInputText.java:498)
                  
                  ...
                  
                  Jun 8, 2007 3:23:38 PM org.apache.catalina.core.StandardWrapperValve invoke
                  SEVERE: Servlet.service() for servlet Faces Servlet threw exception
                  java.lang.NullPointerException
                  at org.ajax4jsf.framework.renderer.AjaxRendererUtils.buildAjaxFunction(AjaxRendererUtils.java:364)
                  at org.ajax4jsf.framework.renderer.AjaxRendererUtils.buildAjaxFunction(AjaxRendererUtils.java:343)
                  at org.ajax4jsf.framework.renderer.AjaxRendererUtils.buildOnEvent(AjaxRendererUtils.java:156)
                  at org.ajax4jsf.ajax.UIAjaxSupport.getEventString(UIAjaxSupport.java:115)
                  at org.ajax4jsf.framework.ajax.EventValueBinding.getValue(EventValueBinding.java:87)
                  at javax.faces.component.ValueExpressionValueBindingAdapter.getValue(ValueExpressionValueBindingAdapte .java:73)
                  ...
                  Jun 8, 2007 3:23:38 PM com.sun.faces.lifecycle.LifecycleImpl phase
                  WARNING: executePhase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl@ec366a) threw exception
                  javax.faces.FacesException: javax.el.ELException: java.lang.NullPointerException
                  at javax.faces.component.UIComponentBase$AttributesMap.get(UIComponentBase.java:1550)
                  at com.sun.faces.renderkit.RenderKitUtils.renderPassThruAttributes(RenderKitUtils.java:440)
                  at com.sun.faces.renderkit.RenderKitUtils.renderPassThruAttributes(RenderKitUtils.java:393)
                  


                  Any ideas? I'm pretty much at my wits ends.

                  Using sample code here:
                  http://labs.jboss.com/file-access/default/members/jbossajax4jsf/freezone/docs/devguide/developerGuide.html#SimpleAJAXEchoProject

                  • 6. Re: Ajax4JSF
                    Jack Foster Newbie

                    Bump. What would cause a 500 error? Is it a server config problem?

                    • 7. Re: Ajax4JSF
                      Ilya Shaikovsky Master

                      try to download the example from examples section and play with it.