title: Deploying Mojarra 2.1.x and 2.2 on Apache Tomcat 7.0.42 and above results in java.lang.UnsupportedOperationException
body: <p>Our JSF web application based on java 7 se, JSF 2.1, using Mojarra 2.1.27 was working fine on Apache Tomcat 7.0.41 and below.  When we attempted to upgrade to Tomcat 7.0.42 and above (we've tried every version up to 7.0.50), after application start up, on the first hit to any URL in the webapp,  we see the following error in the tomcat logs:</p>
  
  <p>I've debugged through this, and it seems the source of the Exception comes from the defaultFacesContext being null. </p>
  
  <h2>Stack Trace</h2>
  
  <pre><code>INFO: Server startup in 1591 ms
  Feb 03, 2014 6:32:25 PM org.apache.catalina.core.StandardContext fireRequestDestroyEvent
  SEVERE: Exception sending request initialized lifecycle event to listener instance of class com.sun.faces.config.ConfigureListener
  java.lang.UnsupportedOperationException
      at javax.faces.context.FacesContext.getExceptionHandler(FacesContext.java:287)
      at javax.faces.event.ExceptionQueuedEventContext.getListenersForEventClass(ExceptionQueuedEventContext.java:262)
      at com.sun.faces.application.ApplicationImpl.invokeComponentListenersFor(ApplicationImpl.java:2128)
      at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:289)
      at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:247)
      at com.sun.faces.application.WebappLifecycleListener.requestDestroyed(WebappLifecycleListener.java:125)
      at com.sun.faces.config.ConfigureListener.requestDestroyed(ConfigureListener.java:344)
      at org.apache.catalina.core.StandardContext.fireRequestDestroyEvent(StandardContext.java:6151)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:207)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:409)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1044)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:744)
  </code></pre>
  
  <p>I've reproduced this start-up exception issue with a very simple application with only one static JSF page with just Hello World and no backing bean, and a minimal web.xml, shown below.  Everything works as expected on Tomcat 7.0.41, but always results in the following error on Tomcat 7.0.42+.</p>
  
  <p>Just wondering if anyone else has run into this issue?</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" 
  version="3.0"&gt;
    &lt;display-name&gt;JSF TEST&lt;/display-name&gt;
    &lt;listener&gt;
      &lt;listener-class&gt;com.sun.faces.config.ConfigureListener&lt;/listener-class&gt;
    &lt;/listener&gt;    
  &lt;/web-app&gt;
  </code></pre>