title: Exception could not find Factory: javax.faces.application.ApplicationFactory
body: <p>I´m using JSF 2.0 Apache MyFaces, TomCat 7.0 and primefaces 3.4.1,</p>
  
  <p>While running my app i got this exception</p>
  
  <pre><code> SEVERE: Exception sending context initialized event to listener instance of class org.apache.myfaces.webapp.StartupServletContextListener java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:851)
      at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:309)
      at org.apache.myfaces.context.servlet.FacesContextImplBase.getApplication(FacesContextImplBase.java:131)
      at org.apache.myfaces.context.servlet.FacesContextImplBase.getELContext(FacesContextImplBase.java:180)
      at javax.faces.component.UIViewRoot.setLocale(UIViewRoot.java:1456)
      at org.apache.myfaces.webapp.AbstractFacesInitializer._createFacesContext(AbstractFacesInitializer.java:391)
      at org.apache.myfaces.webapp.AbstractFacesInitializer.initStartupFacesContext(AbstractFacesInitializer.java:363)
      at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:105)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
      at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      at java.util.concurrent.FutureTask.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
  </code></pre>
  
  <p>here is the web.xml</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_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"&gt;
    &lt;display-name&gt;Capitulo2&lt;/display-name&gt;
    &lt;context-param&gt;
      &lt;description&gt;State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2&lt;/description&gt;
      &lt;param-name&gt;javax.faces.STATE_SAVING_METHOD&lt;/param-name&gt;
      &lt;param-value&gt;client&lt;/param-value&gt;
    &lt;/context-param&gt;
    &lt;context-param&gt;
      &lt;param-name&gt;javax.servlet.jsp.jstl.fmt.localizationContext&lt;/param-name&gt;
      &lt;param-value&gt;resources.application&lt;/param-value&gt;
    &lt;/context-param&gt;
    &lt;filter&gt;
      &lt;filter-name&gt;conexaoFilter&lt;/filter-name&gt;
      &lt;filter-class&gt;financeiro.filter.ConexaoHibernateFilter&lt;/filter-class&gt;
    &lt;/filter&gt;
    &lt;filter-mapping&gt;
      &lt;filter-name&gt;conexaoFilter&lt;/filter-name&gt;
      &lt;url-pattern&gt;*.jsf&lt;/url-pattern&gt;
    &lt;/filter-mapping&gt;
    &lt;resource-ref&gt;
      &lt;description&gt;DataSource financeirodb&lt;/description&gt;
      &lt;res-ref-name&gt;jdbc/financeirodb&lt;/res-ref-name&gt;
      &lt;res-type&gt;javax.sql.DataSource&lt;/res-type&gt;
      &lt;res-auth&gt;Container&lt;/res-auth&gt;
    &lt;/resource-ref&gt;
    &lt;context-param&gt;
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
      &lt;param-value&gt;
  /WEB-INF/applicationContext.xml
  /WEB-INF/applicationContext-security.xml
  &lt;/param-value&gt;
    &lt;/context-param&gt;
    &lt;filter&gt;
      &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
      &lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt;
    &lt;/filter&gt;
    &lt;filter-mapping&gt;
      &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
    &lt;/filter-mapping&gt;
    &lt;listener&gt;
      &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
    &lt;/listener&gt;
    &lt;context-param&gt;
      &lt;param-name&gt;com.sun.faces.expressionFactory&lt;/param-name&gt;
      &lt;param-value&gt;com.sun.el.ExpressionFactoryImpl&lt;/param-value&gt;
    &lt;/context-param&gt;
    &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;index.html&lt;/welcome-file&gt;
      &lt;welcome-file&gt;index.htm&lt;/welcome-file&gt;
      &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
    &lt;/welcome-file-list&gt;
    &lt;context-param&gt;
      &lt;description&gt;
      This parameter tells MyFaces if javascript code should be allowed in
      the rendered HTML output.
      If javascript is allowed, command_link anchors will have javascript code
      that submits the corresponding form.
      If javascript is not allowed, the state saving info and nested parameters
      will be added as url parameters.
      Default is 'true'&lt;/description&gt;
      &lt;param-name&gt;org.apache.myfaces.ALLOW_JAVASCRIPT&lt;/param-name&gt;
      &lt;param-value&gt;true&lt;/param-value&gt;
    &lt;/context-param&gt;
    &lt;context-param&gt;
      &lt;description&gt;
      If true, rendered HTML code will be formatted, so that it is 'human-readable'
      i.e. additional line separators and whitespace will be written, that do not
      influence the HTML code.
      Default is 'true'&lt;/description&gt;
      &lt;param-name&gt;org.apache.myfaces.PRETTY_HTML&lt;/param-name&gt;
      &lt;param-value&gt;true&lt;/param-value&gt;
    &lt;/context-param&gt;
    &lt;context-param&gt;
      &lt;param-name&gt;org.apache.myfaces.DETECT_JAVASCRIPT&lt;/param-name&gt;
      &lt;param-value&gt;false&lt;/param-value&gt;
    &lt;/context-param&gt;
    &lt;context-param&gt;
      &lt;description&gt;
      If true, a javascript function will be rendered that is able to restore the
      former vertical scroll on every request. Convenient feature if you have pages
      with long lists and you do not want the browser page to always jump to the top
      if you trigger a link or button action that stays on the same page.
      Default is 'false'
  &lt;/description&gt;
      &lt;param-name&gt;org.apache.myfaces.AUTO_SCROLL&lt;/param-name&gt;
      &lt;param-value&gt;true&lt;/param-value&gt;
    &lt;/context-param&gt;
    &lt;listener&gt;
      &lt;listener-class&gt;org.apache.myfaces.webapp.StartupServletContextListener&lt;/listener-class&gt;
    &lt;/listener&gt;
    &lt;servlet&gt;
      &lt;servlet-name&gt;Faces Servlet&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;Faces Servlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/faces/*&lt;/url-pattern&gt;
    &lt;/servlet-mapping&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>
  
  <p>I've read a few topics about the same exception but all the solutions suggested are implemented.</p>
  
  <p>Any new idea??</p>