jsfprimefacesrichfacespayarajakarta-migration

Exceptions when using RichFaces or PrimeFaces in Payara 6 with Java 11


I'm migrating a web app to run on Payara Community version 6 (which uses Java 11) from Payara Server 4 (which uses Java 8).

When I deploy the web application, which uses RichFaces I get the following error:

Critical error during deployment: NoClassDefFoundError: javax/faces/FacesWrapper:

enter image description here

Here's the dependency reference to RichFaces the app uses:

<dependency>
    <groupId>org.richfaces</groupId>
    <artifactId>richfaces</artifactId>
    <version>4.5.17.Final</version>
</dependency>

This doesn't happen when I deploy this web app to the old Payara 4 server.

Even worse it appears https://richfaces.jboss.org/ RichFaces has reached end of life in June 2016.

Since seeing this issue I read that PrimeFaces should be used instead, so when I remove the RichFaces and use PrimeFaces and try to deploy I get this new error: LifecycleException: IllegalArgumentException: NoClassDefFoundError: javax/servlet/ServletRequestListener:

enter image description here

As an FYI here's the pom.xml reference to the PrimeFaces dependency:

<dependency>
    <groupId>org.primefaces</groupId>
    <artifactId>primefaces</artifactId>
    <version>13.0.4</version>
</dependency>

Anyone ran into a similar issue? If so how did you get around it?


Solution

  • Payara 6 is Jakarta EE10 so you need to use Jakarta versions of jars which is why the error NoClassDefFoundError: javax/faces/FacesWrapper is happening. To use PrimeFaces Jakarta do this...

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

    I have no idea if RichFaces has a Jakarta version. You can check this fork which keeps RichFaces up to date: https://github.com/albfernandez/richfaces

    You might want to also read this blog post about migrating to Jakarta EE10: https://www.melloware.com/java-ee-6-8-to-jakarta-ee-10-upgrade/