i want to setup a spring boot 2.5.5 war application with primefaces 10 to have the UI framework.
i have started with joinfaces, but i couldn't settled up all the needs. then i removed the joinfaces dependencies, and wanted to setup step by step. unfortunately it seems something is still missing, which i cannot really figure out on my own.
this is pom.xml dependencies
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-ldap</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>10.0.0</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.20</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.2.20</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
this is the main class
@SpringBootApplication
public class CcmtApplication {
protected CcmtApplication() { }
public static void main(String[] args) {
SpringApplication.run(CcmtApplication.class, args);
}
@Bean
ServletRegistrationBean jsfServletRegistration(ServletContext servletContext) {
//spring boot only works if this is set
servletContext.setInitParameter("com.sun.faces.forceLoadConfiguration", Boolean.TRUE.toString());
//registration
ServletRegistrationBean srb = new ServletRegistrationBean();
srb.setServlet(new FacesServlet());
srb.setUrlMappings(Arrays.asList("*.xhtml"));
srb.setLoadOnStartup(1);
return srb;
}
@Bean
public ConfigureListener mojarraConfigureListener() {
return new ConfigureListener();
}
}
and this is the error stack
2021-10-11 18:19:22.202 INFO 14726 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8443 (https)
2021-10-11 18:19:22.222 INFO 14726 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-10-11 18:19:22.223 INFO 14726 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.53]
2021-10-11 18:19:22.316 INFO 14726 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-10-11 18:19:22.316 INFO 14726 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2779 ms
2021-10-11 18:19:22.611 INFO 14726 --- [ restartedMain] j.e.resource.webcontainer.jsf.config : Initializing Mojarra 2.2.20 ( 20190731-0757 59754ac80c05d61848a08939ddd11a324f2345ac) for context ''
2021-10-11 18:19:22.981 INFO 14726 --- [ restartedMain] j.e.r.webcontainer.jsf.application : JSF1048: PostConstruct/PreDestroy annotations present. ManagedBeans methods marked with these annotations will have said annotations processed.
2021-10-11 18:19:24.252 ERROR 14726 --- [ restartedMain] j.e.resource.webcontainer.jsf.config : Critical error during deployment:
java.lang.NoClassDefFoundError: javax/servlet/jsp/JspFactory
at com.sun.faces.config.ConfigureListener.isJspTwoOne(ConfigureListener.java:671) ~[jsf-impl-2.2.20.jar:2.2.20]
at com.sun.faces.config.ConfigureListener.registerELResolverAndListenerWithJsp(ConfigureListener.java:691) ~[jsf-impl-2.2.20.jar:2.2.20]
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:243) ~[jsf-impl-2.2.20.jar:2.2.20]
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4766) [tomcat-embed-core-9.0.53.jar:9.0.53]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5230) [tomcat-embed-core-9.0.53.jar:9.0.53]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [tomcat-embed-core-9.0.53.jar:9.0.53]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396) [tomcat-embed-core-9.0.53.jar:9.0.53]
what am i missing?
thanks for your tips, but finally i have resolved my issue without utilizing joinfaces.
Actually i changed pom in a way that i've removed the sprint-boot starter for tomcat
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
add added
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>