title: NullPointerException at org.omnifaces.facesviews.FacesViewsForwardingFilter
body: <p>I run a Java EE 7 application on WildFly 8.2. I use OmniFaces 1.8.1.
  I see in log files <code>NullPointerExceptions</code> related to <code>FacesViewsForwardingFilter</code>:</p>
  
  <pre><code>2015-02-11 15:42:22,870 ERROR [io.undertow.request] (default task-12) UT005023: Exception handling request to /login: java.lang.NullPointerException
          at org.omnifaces.facesviews.FacesViewsForwardingFilter.doFilter(FacesViewsForwardingFilter.java:122) [omnifaces-1.8.1.jar:1.8.1-20140603]
          at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:77) [omnifaces-1.8.1.jar:1.8.1-20140603]
          at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
          at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
  </code></pre>
  
  
  
  <pre><code>2015-02-11 15:42:31,524 ERROR [io.undertow.request] (default task-15) UT005023: Exception handling request to /search.xhtml: java.lang.NullPointerException
          at org.omnifaces.facesviews.FacesViewsForwardingFilter.doFilter(FacesViewsForwardingFilter.java:153) [omnifaces-1.8.1.jar:1.8.1-20140603]
          at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:77) [omnifaces-1.8.1.jar:1.8.1-20140603]
          at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
  </code></pre>
  
  <p>During server startup I'm seeing this:</p>
  
  <pre><code>2015-02-11 12:28:35,667 ERROR [io.undertow.request] (default task-3) UT005023: Exception handling request to /terms/index: java.lang.IllegalStateException: Illegal attempt to set ViewHandler after a response has been rendered.
          at com.sun.faces.application.ApplicationImpl.setViewHandler(ApplicationImpl.java:583) [jsf-impl-2.2.8-jbossorg-1.jar:]
          at javax.faces.application.ApplicationWrapper.setViewHandler(ApplicationWrapper.java:288) [jboss-jsf-api_2.2_spec-2.2.8.jar:2.2.8]
          at org.jboss.as.jsf.injection.weld.ForwardingApplication.setViewHandler(ForwardingApplication.java:367) [wildfly-jsf-injection-8.2.0.Final.jar:8.2.0.Final]
          at org.omnifaces.facesviews.FacesViewsForwardingFilter.init(FacesViewsForwardingFilter.java:95) [omnifaces-1.8.1.jar:1.8.1-20140603]
          at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:111) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
          at org.wildfly.extension.undertow.security.RunAsLifecycleInterceptor.init(RunAsLifecycleInterceptor.java:85)
  </code></pre>
  
  <p>The relevant configuration in <code>web.xml</code> is:</p>
  
  <pre><code>&lt;servlet&gt;
      &lt;servlet-name&gt;facesServlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;facesServlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;*.html&lt;/url-pattern&gt;
      &lt;url-pattern&gt;*.xhtml&lt;/url-pattern&gt;
      &lt;url-pattern&gt;/javax.faces.resource/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  &lt;context-param&gt;
      &lt;param-name&gt;org.omnifaces.FACES_VIEWS_SCAN_PATHS&lt;/param-name&gt;
      &lt;param-value&gt;/*.xhtml&lt;/param-value&gt;
  &lt;/context-param&gt;
  </code></pre>
  
  <p>How is this caused and how can I solve it?</p>