8 Replies Latest reply on Nov 9, 2009 5:04 AM by Ilya Shaikovsky

    java.lang.NullPointerException: FacesContext is null when us

    Antonio Weber Newbie

      Hi all,

      i have a problem using a4j:include. Here are the first few lines of the Exception I get when it comes to the page using a4j:include (When I copy the content directly in the page it works without problems):

      java.lang.NullPointerException: FacesContext is null
       at org.ajax4jsf.context.AjaxContext.getCurrentInstance(AjaxContext.java:159)
       at org.ajax4jsf.context.AjaxContext.getCurrentInstance(AjaxContext.java:144)
       at org.ajax4jsf.component.AjaxViewRoot.getViewId(AjaxViewRoot.java:583)
       at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:104)
       at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       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:388)
       at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
      


      Perhaps I miss something in the web.xml?

      <?xml version="1.0"?>
      <web-app version="2.5"
       xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
      <display-name>stdplan</display-name>
      
      <context-param>
       <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
       <param-value>server</param-value>
      </context-param>
      
      <context-param>
       <param-name>org.richfaces.SKIN</param-name>
       <param-value>blueSky</param-value>
      </context-param>
      
      <context-param>
       <param-name>org.richfaces.CONTROL_SKINNING</param-name>
       <param-value>enable</param-value>
      </context-param>
      
      <filter>
       <display-name>RichFaces Filter</display-name>
       <filter-name>richfaces</filter-name>
       <filter-class>org.ajax4jsf.Filter</filter-class>
      </filter>
      
      <filter-mapping>
       <filter-name>richfaces</filter-name>
       <servlet-name>Faces Servlet</servlet-name>
       <dispatcher>REQUEST</dispatcher>
       <dispatcher>FORWARD</dispatcher>
       <dispatcher>INCLUDE</dispatcher>
      </filter-mapping>
      
      
      <listener>
       <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
      </listener>
      
      <!-- Faces Servlet -->
      <servlet>
       <servlet-name>Faces Servlet</servlet-name>
       <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
       <load-on-startup>1</load-on-startup>
      </servlet>
      
      <!-- Faces Servlet Mapping -->
      <servlet-mapping>
       <servlet-name>Faces Servlet</servlet-name>
       <url-pattern>*.jsf</url-pattern>
      </servlet-mapping>
      
      </web-app>