Migrating PrimeFaces to Jakarta EE 9+, java.lang.NoClassDefFoundError on javax.*
Asked Answered
P

1

9

I am adopting Jakarta EE 9 and developing an EE application with EJB and WAR modules. EJB is already done and deployed on GlassFish 6. Now I want to develop WAR module with PrimeFaces as part of the same EAR and deploy the EAR on GF 6.

I understood the first PrimeFaces version I can use is 10.0.0-RC2 because this is the first release supporting JSF 3.0 (part of Jakarta EE 9). Am I right? But I got below error:

java.lang.IllegalArgumentException: java.lang.NoClassDefFoundError: javax/servlet/ServletRequestListener

Why does PF 10.0.0-RC2 still depend on javax.* instead of jakarta.*?

The pom dependencies are:

<dependencies>
    <dependency>
        <groupId>jakarta.platform</groupId>
        <artifactId>jakarta.jakartaee-api</artifactId>
        <version>9.0.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.primefaces</groupId>
        <artifactId>primefaces</artifactId>
        <version>10.0.0-RC2</version>
    </dependency> 
</dependencies>
Phasia answered 6/3, 2021 at 17:7 Comment(0)
E
21

PrimeFaces is available in 2 flavors since version 10.0.0: the default flavor using javax.* dependencies and the Jakartified flavor using jakarta.* dependencies. To get the jakarta flavor, you'll need to add a <classifier> to the PrimeFaces dependency and set it to jakarta.

For example:

<dependency>
    <groupId>org.primefaces</groupId>
    <artifactId>primefaces</artifactId>
    <version><!-- 10.0.0, 11.0.0, 12.0.0, etc --></version>
    <classifier>jakarta</classifier>
</dependency> 
Eboni answered 6/3, 2021 at 18:11 Comment(1)
a savior, thank youTowny

© 2022 - 2024 — McMap. All rights reserved.