@FacesConverter does not work with the JSF 2.3 feature of Openliberty with a default config, at least not
if the converter is generic. CDI and JSF 2.3 don’t work with the default config.
Error msg and stack trace from mvn:
[INFO] [ERROR ] SRVE0271E: Uncaught init() exception created by servlet [facesServlet] in application [testapp]: 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!
[INFO] 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.
[INFO] A typical config looks like this;
[INFO] <listener>
[INFO] <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
[INFO] </listener>
[INFO]
[INFO] at javax.faces.FactoryFinder._getFactory(FactoryFinder.java:310)
[INFO] at [internal classes]
[INFO]
[INFO] [ERROR ] SRVE0276E: Error while initializing Servlet [facesServlet]: javax.servlet.ServletException: SRVE0207E: Uncaught initialization exception created by servlet
[INFO] at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:368)
[INFO] at [internal classes]
[INFO] 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!
[INFO] 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.
[INFO] A typical config looks like this;
[INFO] <listener>
[INFO] <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
[INFO] </listener>
[INFO]
[INFO] at javax.faces.FactoryFinder._getFactory(FactoryFinder.java:310)
[INFO] ... 1 more
[INFO]
package de.knusperfisch.dsgvo.app;
import javax.enterprise.context.ApplicationScoped;
import javax.faces.annotation.FacesConfig;
import static javax.faces.annotation.FacesConfig.Version.JSF_2_3;
@FacesConfig(
// Activates CDI build-in beans
version = JSF_2_3
)
@ApplicationScoped
public class ConfigurationBean {
}
Caution: If bean discovery mode is switched from “all” to “annotated”, every JSF backing bean must be
declared with @FacesConfig, which sucks.
using @FacesConverter
When using @FacesConverter, use it together with ‘forClass’, not using the parameter ‘forClass’
(or its alternative) will again result in the above err msg / stack trace.