Spring Boot 3 and JSF with Jakarta not working
Asked Answered
M

1

3

Spring Boot 3 gives with its milestones the customers time to migrate from Java EE to Jakarta, changing package names from javax to jakarta. But it's more than package names. I can't get Spring Boot to run with JSF, let alone Primefaces-Jakarta.

All solutions I try, seem to either rely on CDI, and then complain there is no working CDI, --> because Spring Boot has another injection mechanism, this isn't Glassfish. Or it complains it can't find the factories, like this:

Servlet.init() for servlet [facesServlet] threw exception
    java.lang.IllegalStateException: Keine Factory als Backup für jakarta.faces.lifecycle.LifecycleFactory gefunden.
        at jakarta.faces.FactoryFinderInstance.notNullFactory(FactoryFinderInstance.java:496) ~[jakarta.faces-api-4.0.1.jar:na]
        at jakarta.faces.FactoryFinderInstance.getFactory(FactoryFinderInstance.java:190) ~[jakarta.faces-api-4.0.1.jar:na]

If I set factory class names manually, they want CDI again, and I'm back where I started (and I don't want to have Spring and CDI existing in parallel anyway).

I use the latest versions of the Jakarta libraries and Spring Boot milestones. Like "jakarta.faces:jakarta.faces-api:4.0.1", "org.glassfish:jakarta.faces:4.0.0" and "org.springframework.boot:spring-boot-starter-web:3.0.0-M4".

Is there any tutorial, open-source project or anything else which shows how it's done?

Mungo answered 25/7, 2022 at 17:4 Comment(0)
S
2

Adding at the end of your faces config following could help:

servletContext.setAttribute(com.sun.faces.RIConstants.FACES_INITIALIZER_MAPPINGS_ADDED, Boolean.TRUE);
Schubert answered 16/9, 2022 at 2:6 Comment(1)
Thanks. But I "gave up" and ended, like I guess many people, using JoinFaces (joinfaces.org). But I keep this in mind if I run into similiar problems with JoinFaces in the future.Mungo

© 2022 - 2024 — McMap. All rights reserved.