Question

How can I deploy a web-app (war) on different GlassFish standalone instances, while using different Mojarra versions on every instance.

We are planning to update the used Mojarra version from 2.1.6 used default by GF 3.1.2.2 to Mojarra 2.1.24. In our JSF Applications we are using PrimeFaces from version 2.2 to 3.5. Before we go in production with our application, after Mojarra update, we want to test it on a standalone GlassFish instance within the same Node.

How can we accomplish, that the app deployed on this standalone instance is using different Mojarra version then available on the domain administration server. The project is build with maven.

    <dependency>
        <groupId>org.glassfish</groupId>
        <artifactId>javax.faces</artifactId>
        <version>2.1.24</version>
        <scope>runtime</scope>
    </dependency>

Tried scope of the dependency with compile, provided and runtime. While deploying

[#|2013-10-25T13:11:25.122+0200|INFO|glassfish3.1.2|javax.enterprise.resource.webcontainer.jsf.config|_ThreadID=150;_ThreadName=Thread-2;|Mojarra 2.1.6 (SNAPSHOT 20111206) für Kontext '/TestApp'

Even putting javax.jaces.jar in instance-root/lib/applibs and setting --libraries option while deploying dowsn't work.

Thanks for any ideas.

Was it helpful?

Solution

Well, what you can do is using Maven profiles to include conditional dependencies. Glassfish contains jsf API and implementation out of the box. So what you need for your project is to specify what API you want to code against, marking it as provided as you don't need to deploy them:

<profiles>
    <profile>
        <id>old-glassfish</id>
        <dependencies>
            <dependency>
                <groupId>javax.faces</groupId>
                <artifactId>jsf-api</artifactId>
                <version>2.0</version>
                <scope>provided</scope>
            </dependency>
        </dependencies>
    </profile>
    <profile>
        <id>new-glassfish</id>
        <dependencies>
            <dependency>
                <groupId>javax.faces</groupId>
                <artifactId>jsf-api</artifactId>
                <version>2.1</version>
                <scope>provided</scope>
            </dependency>
        </dependencies>
    </profile>
</profiles>

I don't do Glassfish, but also you should change the provided JSF libraries to stablish the one you're interested in. There are some threads here at SO which explain what you have to do to update them.

Otherways, you could also use your own JSF implementation for each application, configuring the server properly not to use its bundled libraries.

See also:

How to update Mojarra version in GlassFish

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top