javajsfjakarta-eepayara-micro

Upgrading to JakartaEE 10 - can't compile because "cannot access javax.faces.event.FacesEvent"


My project is this web app: https://nocodefunctions.com, open sourced here.

It runs on Payara Community Edition: Payara Micro 5.2022.4

I am moving it to JakartaEE 10 and JSF 3. JakartaEE 10 and Payara 6 (which runs on it) are so recent that NetBeans 15 does not manage them yet.

So I try to develop without NetBeans, directly from the CLI, which is something I am unfamiliar with. I think I can:

  1. compile the project with maven (mvn clean install), which creates an single jar of the app
  2. then deploy the from the command line to the payara server

I am stuck at step 1:

 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project jsf-app: Compilation failure:
Compilation failure:
[ERROR] /C:/Users/levallois/open/no code app/webapp/jsf-app/src/main/java/net/clementlevallois/nocodeapp/web/front/importdata/DataImportBean.java:[286,21] cannot access javax.faces.event.FacesEvent
[ERROR]   class file for javax.faces.event.FacesEvent not found
[ERROR] /C:/Users/levallois/open/no code app/webapp/jsf-app/src/main/java/net/clementlevallois/nocodeapp/web/front/functions/TopicsBean.java:[405,37] cannot access javax.faces.event.AjaxBehaviorEvent
[ERROR]   class file for javax.faces.event.AjaxBehaviorEvent not found

I have found a couple of questions on SO that point to the same error, with answers by @BalusC, but I am still stuck.

The relevant part of the faces-config.xml:

<faces-config
    xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
        http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_3_0.xsd"
    version="2.3">
</faces-config>

Solution

  • As of November 2022, Primefaces requires a "jakarta" classifier to make sure it pulls Jakarta dependencies, like so:

    <dependency>
        <groupId>org.primefaces</groupId>
        <artifactId>primefaces</artifactId>
        <version>12.0.0</version>
        <classifier>jakarta</classifier>
    </dependency>