Search code examples
jsfjakarta-eethorntail

Where FacesMessage FacesContext in Thorntail 2.3?


I'm developing test task, with stack: thorntail 2.3.0.Final, PrimeFaces 6.2.

There is example:

public void onRowEdit(RowEditEvent event) {
    FacesMessage msg = new FacesMessage("Car Edited", ((Car) event.getObject()).getId());
    FacesContext.getCurrentInstance().addMessage(null, msg);
}

But I can't import FacesMessage and FacesContext, my IDE can't find them in all dependencies

A bit of my pom.xml thorntail with bom:

…
    <dependency>
        <groupId>io.thorntail</groupId>
        <artifactId>cdi</artifactId>
    </dependency>
    <dependency>
        <groupId>io.thorntail</groupId>
        <artifactId>jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>io.thorntail</groupId>
        <artifactId>jsf</artifactId>
    </dependency>
…

So, what's going on? It's jsf 2.3 with some new approaches to this packages or something else?

I've read about jsf 2.3 that it has new features and some deprecations.

Also where @ViewScoped? What now we should use with CDI?

Where package for import javax.faces.*?

I'm confused…


Solution

  • Looks like a bug in that https://github.com/thorntail/thorntail/blob/master/fractions/javaee/jsf/pom.xml doesn't add the JSF APIs as dependencies available to your application.

    An easy fix is to add the JSF APIs as "provided" in your project, as at runtime they will be used fine.