java.lang.NoSuchMethodError: javax.faces.view.facelets.FaceletCache.setCacheFactories(Ljavax/faces/view/facelets/FaceletCache$MemberFactory;Ljavax/faces/view/facelets/FaceletCache$MemberFactory;)V
This method is new since JSF 2.3. This problem thus suggests you've an older JSF API version in runtime classpath.
Based on your pom.xml
, the following dependencies are conflicting:
<dependency>
<groupId>javax.faces</groupId>
<artifactId>javax.faces-api</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
</dependency>
The first represents the JSF 2.2 API (which is only the javax.faces.*
part of Java EE 7 API). Remove it altogether. The JSF 2.3 dependency has its own set already.
The second represents the entire Java EE 7 API, including JSF 2.2, Servlet 3.1, EL 3.0, CDI 1.1, JAX-RS 1.0, JSONP 1.0, etc. This one may absolutely not end up in webapp's runtime classpath. This one is supposed to be provided by the target runtime already. You need to mark it provided
.
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
This is actually misleading when you're instead of a real Java EE server targeting a barebones servletcontainer such as Tomcat 8.0, which only ships JSP 2.3, Servlet 3.1, EL 3.0 and WebSockets 1.1 out the box. You're supposed to specify them all individually instead of the entire Java EE 7 API. Otherwise you must be careful while writing code that you don't accidentally import/use some parts of Java EE 7 API which are actually not provided by Tomcat such as JSF, JSTL, CDI, etc. You'd then need to explicitly provide them along with the webapp (as you already did for some parts).