title: Application error with MyFaces 1.2: java.lang.IllegalStateException: No Factories configured for this Application
body: <p>For my app I'm using <strong>Tomcat 6.0.x</strong> and <strong>Mojarra 1.2_04</strong> JSF implementation. 
  It works fine, just I would like to switch now to <strong>MyFaces 1.2_10</strong> impl of JSF.</p>
  
  <p>During the deployment of my app a get the following error:</p>
  
  <pre><code>ERROR [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/myApp]] StandardWrapper.Throwable
  java.lang.IllegalStateException: No Factories configured for this Application. This happens if the faces-initialization does not work at all - make sure that you properly include all configuration settings necessary for a basic faces application and that all the necessary libs are included. Also check the logging output of your web application and your container for any exceptions!
  If you did that and find nothing, the mistake might be due to the fact that you use some special web-containers which do not support registering context-listeners via TLD files and a context listener is not setup in your web.xml.
  A typical config looks like this;
  &lt;listener&gt;
    &lt;listener-class&gt;org.apache.myfaces.webapp.StartupServletContextListener&lt;/listener-class&gt;
  &lt;/listener&gt;
  
      at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:106)
      at javax.faces.webapp.FacesServlet.init(FacesServlet.java:137)
      at org.apache.myfaces.webapp.MyFacesServlet.init(MyFacesServlet.java:113)
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1172)
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:992)
      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4058)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4371)
  ...
  </code></pre>
  
  <p>Here is part of my web.xml configuration:</p>
  
  <pre><code>    &lt;servlet&gt;
          &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
          &lt;!-- &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt; --&gt;
          &lt;servlet-class&gt;org.apache.myfaces.webapp.MyFacesServlet&lt;/servlet-class&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
  
      ...
      &lt;listener&gt;
           &lt;listener- class&gt;org.apache.myfaces.webapp.StartupServletContextListener&lt;/listener-class&gt;
      &lt;/listener&gt;
  </code></pre>
  
  <p>Has anyone experienced similar error, and what should I do i order to fix it? Thanx!</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I was able to fix the problem. Since I am using delegator for <strong>FacesServlet</strong>, it turned out that this delegator was causing the problem. 
  All I needed to do is to make this class implement <strong>DelegatedFacesServlet</strong>, and I've removed <em>org.apache.myfaces.webapp.StartupServletContextListener</em>. Here is my web.xml now:</p>
  
  <pre><code>    &lt;servlet&gt;
          &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
          &lt;!-- &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt; --&gt;
          &lt;servlet-class&gt;org.apache.myfaces.webapp.MyFacesServlet&lt;/servlet-class&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;Faces Servlet Delegator&lt;/servlet-name&gt;
          &lt;servlet-class&gt;com.myapp.web.FacesServletDelegator&lt;/servlet-class&gt;
          &lt;load-on-startup&gt;2&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;Faces Servlet Delegator&lt;/servlet-name&gt;
          &lt;url-pattern&gt;*.jsf&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>and here is <strong>FacesServletDelegator</strong></p>
  
  <pre><code>public class PLMFacesServlet extends HttpServlet implements DelegatedFacesServlet {
  
      private MyFacesServlet delegate;
  
      public final void init(ServletConfig servletConfig) throws ServletException {
          delegate = new MyFacesServlet();
          delegate.init(servletConfig);
      }
  
      public final void destroy() {
          delegate.destroy();
      }
  
      public final ServletConfig getServletConfig() {
          return delegate.getServletConfig();
      }
  
      public final String getServletInfo() {
          return delegate.getServletInfo();
      }
  
      public final void service(HttpServletRequest request, HttpServletResponse response) throws ServletException {
  
         try {
             delegate.service(request, response);
         } catch(Exception e) {}
      }
      // some other code...
  }
  </code></pre>
  
  <p><strong>EDIT 2</strong>:</p>
  
  <p>Following <strong>BalusC</strong> advice, I've edited my <em>web.xml</em> a bit, here is the final version:</p>
  
  <pre><code>&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&gt;
      &lt;servlet-name&gt;Faces Servlet Delegator&lt;/servlet-name&gt;
      &lt;servlet-class&gt;com.myapp.web.FacesServletDelegator&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;2&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;Faces Servlet Delegator&lt;/servlet-name&gt;
      &lt;url-pattern&gt;*.jsf&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>