title: JSF not working on WebSphere Liberty Profile
body: <p>I am Using the WebSphere Application Server V8.5 Liberty Profile in Eclipse Juno.
  I configured my AppServer (server.xml) and added the jsp-2.2, jsf2.0, localConnector-1.0 and servlet-3.0 Feature.</p>
  
  <p>When I deploy my project and open a JSP-Page in my browser, all went fine.
  But when I want to open a JSF-Page, then I get the following exception:</p>
  
  <pre><code>[ERROR   ] An error occured while initializing MyFaces: org.apache.myfaces.spi.impl.DefaultFacesConfigurationMergerFactory cannot be cast to org.apache.myfaces.spi.FacesConfigurationMergerFactory
  [ERROR   ] Uncaught.init.exception.thrown.by.servlet
  [ERROR   ] SRVE0266E: Error occured while initializing servlets: javax.servlet.ServletException: SRVE0207E: Uncaught initialization exception created by servlet
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:382)
      at com.ibm.ws.webcontainer.osgi.servlet.ServletWrapper.init(ServletWrapper.java:83)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.loadOnStartupCheck(ServletWrapper.java:1353)
      at com.ibm.ws.webcontainer.webapp.WebApp.doLoadOnStartupActions(WebApp.java:862)
      at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinally(WebApp.java:831)
      at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:753)
      at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:5694)
      at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.createRunnableHandler(DynamicVirtualHost.java:220)
      at com.ibm.ws.http.internal.VirtualHostImpl.discriminate(VirtualHostImpl.java:165)
      at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.ready(HttpDispatcherLink.java:157)
      at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:444)
      at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleNewRequest(HttpInboundLink.java:378)
      at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.processRequest(HttpInboundLink.java:278)
      at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.ready(HttpInboundLink.java:249)
      at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:174)
      at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:83)
      at com.ibm.ws.tcpchannel.internal.WorkQueueManager.requestComplete(WorkQueueManager.java:502)
      at com.ibm.ws.tcpchannel.internal.WorkQueueManager.attemptIO(WorkQueueManager.java:550)
      at com.ibm.ws.tcpchannel.internal.WorkQueueManager.workerRun(WorkQueueManager.java:899)
      at com.ibm.ws.tcpchannel.internal.WorkQueueManager$Worker.run(WorkQueueManager.java:981)
      at com.ibm.ws.threading.internal.Worker.executeWork(Worker.java:398)
      at com.ibm.ws.threading.internal.Worker.run(Worker.java:380)
      at java.lang.Thread.run(Unknown Source)
  Caused by: 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:172)
  at javax.faces.webapp.FacesServlet.init(FacesServlet.java:112)
  at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:320)
  ... 22 more
  </code></pre>
  
  <p>My web.xml was generated by eclipse and looks like:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app id="WebApp_ID" version="3.0" 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_3_0.xsd"&gt;
      &lt;display-name&gt;WAS-Liberty-Test&lt;/display-name&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;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;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;enabled&gt;true&lt;/enabled&gt;
          &lt;async-supported&gt;false&lt;/async-supported&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;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&gt;default.html&lt;/welcome-file&gt;
          &lt;welcome-file&gt;default.htm&lt;/welcome-file&gt;
          &lt;welcome-file&gt;default.jsp&lt;/welcome-file&gt;
      &lt;/welcome-file-list&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>So what is the problem here?</p>