1 Reply Latest reply on Nov 27, 2007 12:16 PM by timleung22

    NullPointerException in AjaxViewHandler.createView

    timleung22

      Has anyone experienced a NullPointerException on line 85 of AjaxViewHandler.createView method? I am using Facelet with RichFaces 3.1.0 (same problem happens in 3.1.2.GA) and I am frequently experiencing this NullPointerException issue, while on a lucky day the page works fine.

        • 1. Re: NullPointerException in AjaxViewHandler.createView
          timleung22

          After chasing the code in the debugger, I found that the cause of the problem is that the "ajaxContext" cannot be resolved from the FacesContext, given the fact that I am using the Spring framework's DelegatingVariableResolver. In AjaxContext.java, there is this code

          AjaxContext ajaxContext = (AjaxContext) context.getApplication()
          .getVariableResolver().resolveVariable(context,
          AJAX_CONTEXT_KEY);
          if (null == ajaxContext) {
          // TODO Create default implementation.
          // ajaxContext = new AjaxContext();
          // context.getExternalContext().getRequestMap().put(AJAX_CONTEXT_KEY,
          // ajaxContext);
          }
          return ajaxContext;

          now my AJAX_CONTEXT_KEY cannot be resolved, why is the instantiation of ajaxContext commented?
          Am I missing anything on the faces-config.xml?