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:
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.