title: java.lang.ClassCastException: Cannot cast com.sun.faces.config.FacesInitializer to javax.servlet.ServletContainerInitializer
body: <p>I had a maven project (DWM3, Tomcat8) which functioned correctly. I was told to re-implement current functionality using JSF. </p>
  
  <p>Current maven dependencies are:</p>
  
  <ul>
  <li>jstl : 1.2</li>
  <li>primefaces : 4.0 -> newly added</li>
  <li>javaee-api : 7.0 -> newly added</li>
  <li>jsf-impl : 2.2.3 -> newly added</li>
  <li>jsf-api : 2.2.3 -> newly added</li>
  </ul>
  
  <p>Using Eclipse IDE with WTP 3.6.0M6. Was told I must use these versions.</p>
  
  <p>Now onto the exception. I hadn't done any changes to my previous working code (1 servlet) and if I remove the newly added dependencies the exception dissapears and my webapp works again. </p>
  
  <pre><code>SEVERE: Failed to process JAR found at URL [/test] for ServletContainerInitializers for context with name [{1}]
  java.io.IOException: java.lang.ClassCastException: Cannot cast com.sun.faces.config.FacesInitializer to javax.servlet.ServletContainerInitializer
      at org.apache.catalina.startup.WebappServiceLoader.loadServices(WebappServiceLoader.java:185)
      at org.apache.catalina.startup.WebappServiceLoader.load(WebappServiceLoader.java:151)
      at org.apache.catalina.startup.ContextConfig.processServletContainerInitializers(ContextConfig.java:1597)
      at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1125)
      at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:768)
      at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:303)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
      at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5058)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1388)
      at java.util.concurrent.FutureTask.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
  Caused by: java.lang.ClassCastException: Cannot cast com.sun.faces.config.FacesInitializer to javax.servlet.ServletContainerInitializer
      at java.lang.Class.cast(Unknown Source)
      at org.apache.catalina.startup.WebappServiceLoader.loadServices(WebappServiceLoader.java:182)
      ... 15 more
  </code></pre>
  
  <p>So I'm unsure as to where is the source of the dependency conflicts which causes this exception</p>