'Migrating from JSF 2.2 to JSF 2.3
I want to migrate from JSF 2.2 To JSF 2.3, the application was working fine when i have those two dependencies of JSF 2.2
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
<version>2.2.0</version>
</dependency>
But when i replaced them by those dependencies
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
<version>2.3-next-M3</version>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
<version>2.3-next-M3</version>
</dependency>
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<version>1.2</version>
<scope>provided</scope>
</dependency>
i got an error saying
No Factories configured for this Application
A typical config looks like this;
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-
class>
</listener>
Here is the Servlet Registration Bean
@Bean
public ServletRegistrationBean facesServlet() {
FacesServlet servlet = new FacesServlet();
ServletRegistrationBean registration = new ServletRegistrationBean(servlet, "*.jsf");
registration.setName("Faces Servlet");
registration.setLoadOnStartup(1);
registration.setMultipartConfig(new
MultipartConfigElement((String) null));
return registration;
}
The ServletContext Initilializer
@Bean
public ServletContextInitializer servletContextInitializer() {
return servletContext -> {
servletContext.setInitParameter("javax.faces.FACELETS_SKIP_COMMENTS", Boolean.TRUE.toString());
servletContext.setInitParameter("primefaces.FONT_AWESOME", Boolean.FALSE.toString());
servletContext.setInitParameter("javax.faces.FACELETS_LIBRARIES", "/WEB-INF/primefaces-california.taglib.xml");
servletContext.setInitParameter("primefaces.THEME", "california-#{guestPreferences.theme}");
servletContext.setInitParameter("javax.faces.PROJECT_STAGE", "PRODUCTION");
servletContext.setInitParameter("javax.faces.STATE_SAVING_METHOD", "server");
};
}
And iam using Tomcat server
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
I tried to add the StartupServletContextListener in web.xml but nothing happens
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
