JSF 2.2.x | useBundeledJsf | Payara 5

Hey,

is it possible to start Payara with Mojarra 2.2.20 in the deployment via payara-web.xml? I have a problem with Primefaces 11, which only runs error-free with version 2.2.20.
As of Mojarra 2.3.x there are some problems that will probably only be solved over time.

payara-web.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE payara-web-app PUBLIC "-//Payara.fish//DTD Payara Server 4 Servlet 3.0//EN" "https://docs.payara.fish/schemas/payara-web-app_4.dtd">
<payara-web-app error-url="">
    <context-root>merlin</context-root>

    <class-loader delegate="false"/>
    <property name="useBundledJsf" value="true" />
</payara-web-app>

pom.xml

        <dependency>
            <groupId>org.glassfish</groupId>
            <artifactId>javax.faces</artifactId>
            <version>2.2.20</version>
<!--            <scope>provided</scope>-->
        </dependency>

With these settings, my context still boots up with “Mojarra 2.3.14.payara-p3”.
What else do I have to configure?

Steven

Hi Steven,

I was unable to reproduce this issue, I have been able to use a specific JSF version within my application successfully, I have attached my reproducer project so you can take a look, however it is very similar to yours. GitHub - JamesHillyard/MojarraSample: https://forum.payara.fish/t/jsf-2-2-x-usebundeledjsf-payara-5/399

Deploying that application to Payara Server 5.2022.2 and navigating to http://localhost:8080/mojarrasample-1.0-SNAPSHOT/reproducer/jsf shows the expected Mojarra version being used.

Thanks,
James

1 Like

Hey James,

I will test your example. Thanks a lot for this. I’ll see what’s different about my project and why the settings are being ignored. I will report back on this.

Steven

Hey James,

your example works for test project. Nice.

But now I’m trying to deploy Primefaces in this JSF 2.2 context, which fails. Do I have to configure something else in the web.xml so that Primefaces recognizes that the JSF 2.2 context is active here? Primefaces always searches internally for the JSF2.3 context.

Primefaces JSF22

Exception when deploying:

Exception while loading the app : java.lang.IllegalStateException: 
ContainerBase.addChild: start: org.apache.catalina.LifecycleException: 
java.lang.RuntimeException: java.lang.LinkageError: loader constraint violation: 
when resolving overridden method "org.primefaces.expression.impl.Jsf23WidgetVarSearchKeywordResolver.resolve(Ljavax/faces/component/search/SearchKeywordContext;Ljavax/faces/component/UIComponent;Ljava/lang/String;)V" the class loader (instance of org/glassfish/web/loader/WebappClassLoader) of the current class, org/primefaces/expression/impl/Jsf23WidgetVarSearchKeywordResolver, and its superclass loader (instance of org/apache/felix/framework/BundleWiringImpl$BundleClassLoader), have different Class objects for the type javax/faces/component/UIComponent used in the signature]]
  • Payara 5.2022.2
  • Java SDK 8.332
  • Windows 10

Hi Steven,

I’m glad to hear my sample project was able to help you. I have been able to reproduce the exception when deploying the application you provided with Primefaces 11 included.

I have confirmed there is no conflict of transitive dependencies causing an issue, Primefaces should therefore pickup the JSF2.2 context. I suspect there may be a bug here, but I will continue to investigate this to see if there is a property missing from our documentation.

I have also tested this same application on GlassFish 5 and the same error occurs, so I would like to conclusively determine if there is a bug within Payara & GlassFish or the error lies with Primefaces.

If you require this urgently, I would again recommend a Payara Enterprise subscription where you can raise tickets to our support team for a top priority investigation.

Thanks,
James

1 Like

Hey James,

We will definitely conclude an Enterprise contract if we can be sure that the migration from WebLogic 14 to Payara5 is 100% guaranteed. We are a small company and we have to think carefully about any financial investment as we can only choose one system (server).

Steven

Hi Steven,

I see you raised this issue with Primefaces Error message starting Primefaces webapp in Payara 5 (with useBundledJsf property) LinkageError Jsf23WidgetVarSearchKeywordResolver Component: Title · Issue #9080 · primefaces/primefaces · GitHub where they believe the error to be with Payara still having JSF 2.3 on the classpath. I verified this against Payara 4 which uses JSF 2.2 OOTB and the application deploys successfully.

It would therefore appear setting the class-loader delegate to false, and useBundledJsf to true doesn’t remove JSF 2.3 from the classloaders entirely and therefore hasn’t fully downgraded JSF to 2.2 in Payara Server 5.

This may be a bug within Payara and Glassfish where this feature is not working properly, I will evaluate if this feature should allow a change in JSF versions from 2.3 to 2.2 and get back to you shortly.

Thanks,
James

Hello James,

exactly, I created this ticket there, hoping that the Primefaces team would have an idea.
Nice that you take a closer look at the topic. Thanks a lot for this.

Steven