13

I want to update my JSF application to use Mojarra version 2.1.8. I added these lines into the POM file of the WAR package:

<dependency>
    <groupId>org.glassfish</groupId>
    <artifactId>javax.faces</artifactId>
    <version>2.1.8</version>
</dependency> 

I also added the JSF repository. I package is build successfully with the Mojarra version 2.1.8. But when I open the GlassFish log I see that there is a Mojarra version 2.1.6 deployed. What am I missing? Do I need to make some configuration into the GlassFish server?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
user1285928
  • 1,328
  • 29
  • 98
  • 147

1 Answers1

17

GlassFish itself already ships with JSF bundled which get by default classloading precedence over the one bundled in the webapp. You basically need to tell GlassFish to use the webapp bundled JSF instead.

Edit the webapp's /WEB-INF/glassfish-web.xml (or /WEB-INF/sun-web.xml if you're using one of the first GF3 versions) to add the following two entries:

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

GlassFish will then use the webapp bundled JSF instead.

Alternatively, if you have full admin control over GlassFish, then you can also copy it in the /glassfish/modules directory, replacing the older version, so that it get applied on all webapps.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • I solved the problem. I downloaded JSF 2.l.8 jar and I replaced the module in Glassfish. – user1285928 May 28 '12 at 12:38
  • Could you please share the link and/or a maven identifier of the artifact referred to with "JSF 2.1.8.jar" as the above solution doesn't work completely (solves some issues but some are remaining) for me?! – Kalle Richter May 31 '14 at 20:10
  • @Karl: [JSF homepage](https://javaserverfaces.java.net) --> [Download](https://javaserverfaces.java.net/nonav/2.2/download.html) --> [Maven](https://maven.java.net/content/repositories/releases/org/glassfish/javax.faces/) – BalusC Jun 01 '14 at 08:32
  • Is there is really necessary to set the `class-loader delegate` to false in order to turn the `useBundledJsf` property to true? What would happen if I leave `delegate="true"? – Mathieu Castets Jan 21 '15 at 13:05
  • @MathieuCastets: by default, server-provided API libraries have higher classloading precedence than webapp-provided API libraries. The `delegate="false"` basically puts it the other way round. – BalusC Aug 10 '15 at 08:31