We\'ve been running a web app on a development server and recently somebody built a production server for us (with supposedly) the exact same tomcat config including the JSF
The webapp's runtime classpath is a mess.
Get rid of those JARs in /WEB-INF/lib
javaee-web-api-7.0.jar
javax.faces-2.2.5.jar
javax.servlet-api-3.0.1.jar
The first one is intented to be used to compile a WAR/EAR targeting a Java EE 7 container. It isn't intented to be installed along a WAR targeting a barebones JSP/Servlet container like Tomcat. It would get confused and think that it's actually a Java EE 7 container (oh joy).
The second one is Mojarra 2.2.5 (API and impl bundled in single-JAR flavor) and the cause of the initial trouble you're seeing. You're basically loading a JSF 2.2 implementation against a JSF 2.1 API already earlier loaded via Tomcat's /lib
. The javax.faces.lifecycle.ClientWindowFactory
is new since JSF 2.2 (see also @since
in javadoc) and not recognized by JSF 2.1 API.
The third one is supposed to be already provided by Tomcat itself. Note that Java EE 7 JAR also contains JSF 2.2 and Servlet 3.1 APIs. So that's after all actually a triple conflict for JSF and Servlet APIs (one API from Tomcat's /lib
, one API from WAR's /WEB-INF/lib
, and one API from Java EE 7 JAR bundle; that's not good).
Regardless, I recommend to clean up Tomcat's /lib as well and keep it as default. Just stick to JARs in WAR's /WEB-INF/lib. And, if you actually intend to build a JSF 2.2 targeted web application (first doublecheck version
in faces-config.xml
if it matches), then keep in the javax.faces-2.2.5.jar
and get rid of those jsf-api-2.1.13.jar
and jsf-impl-2.1.13.jar
files.
I had this same error but using WildFly. Don't know why but, I couldn't see the CDI facet option to add to my project. So in order to suppress this error message I had to create the beans.xml manually inside WEB-INF folder.
That was the content:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bean-discovery-mode="all" version="1.1"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"/>
cheers
Very weird behavior on my side, I had the exact same issue with wildfly 14.
It suddenly started to work again, when i renamed one of my beans called as a validator in a httpInputText. I renamed it from "my_Bean" to "myBean" removing the underscore "_".
I do not have a beans.xml under web-inf. And i did not used maven dependency for CDI. Doing this trick worked. Hope it will fix some of the issues for other people.