0
votes

My application server is Glassfish 3.1.1, using Mojarra 2.0.3 FCS (as far as I know). I want my application to use JSF 2.1.2. I've already found the correct artifact to use in my maven build.

Now, how can I make sure the JSF classes are loaded from this artifact, instead of following "classical" delegation to Glassfish libvrary classloader (which will load JSF 2.0.3 and generate ClassNotFoundException for my omnifaces/richfaces additional components) ?

1

1 Answers

2
votes

In general, how to override a specific Java EE artifact from an archive is application server specific. In case of GlassFish, if I'm not mistaken you can use the following in WEB-INF/glassfish-web.xml:

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

What also works is replacing the jar in [glassfish home]/glassfish/modules. This is exactly what the JSF build script does as well, so it should be guaranteed to work.

Do note that if you go from something as low as 2.0.3 to a current version, you'll see that there has been a change from 2 jars to 1 jar. So in that case in [glassfish home]/glassfish/domains/domain1/config/default-web.xml and [glassfish home]/glassfish/lib/templates/default-web.xml remove the entries jsf-api.jar and jsf-impl.jar and replace them by a single javax.faces.jar.

Perhaps an even easier alternative is to download the latest version of GlassFish (3.1.2.2).