Version 1

    You know Seam 2.x is literally dead project for long ago now, but if somebody would like to use a Seam 2 based application on the latest greatest Wildfly they won't run smoothly due JSF 2.2 which is by default on.

    So i tried to check if there is a possible way how to run an old seam example on Wildfly 8.2.0.Final and soon coming Wildfly 9.

     

    JSF 2.1 requirement

    Seam 2.3.x is integrated with JSF 2.x and therefore JSF 2.2.x is not simple replacement of 2.x so we need first to enable proper JSF on Wildfly server.

    You can do it by bundling the correct version of JSF and manage its usage through jboss-deployment-structure.xml file, but that is not new and cool thing.

    What I would like to describe is you can use Widfly multi-JSF feature - see Design of WildFly Multi-JSF feature

    For this article I used JSF 2.1.23 released version, but you of course could use any other available version 2.0.x or 2.1.x.

     

    I followed https://developer.jboss.org/wiki/StepsToAddAnyNewJSFImplementationOrVersionToWildFly and did exactly:

    1. get sources from Wildfly github repository (for 9.x use  - just replace 8 with 9) - git clone git://github.com/wildfly/wildfly.git && git co -b 8.x origin/8.x
    2. Build Wildfly locally - ./build.sh
    3. Create assembly of your selected JSF implementation in jsf/multi-jsf-installer Wildfly submodule
      cd jsf/multi-jsf-installer
      mvn -Djsf-version=2.1.23 -Pmojarra-2.x clean assembly:single
      mv target/install-mojarra-2.1.23.zip target/install-mojarra-2.1.23.cli
    4. Start Wildfly in profile which you would like to install your newly assembled JSF (I will use default profile standalone) and then in another terminal I will use Wildfly CLI:
      <local_wildfly_distribution>/bin/standalone.sh
      <local_wildfly_distribution>/bin/jboss-cli.sh -c
      deploy target/install-mojarra-2.1.23.cli
    5. Restart Wildfly and check the installed JSF with:
      bin/jboss-cli.sh -c --commands="/subsystem=jsf/:list-active-jsf-impls"
      result should be

    {

        "outcome" => "success",

        "result" => [

            "mojarra-2.1.23",

            "main"

        ]

    }

     

    Now you can exclude the main JSF slot and set your JSF versioned slot in your application jboss-deployment-structure.xml file like it is described in Class Loading in WildFly - WildFly 8 - Project Documentation Editor or you can change default JSF in Wildfly to be 2.1.23 version by:

    <local_wildfly_distribution>/bin/jboss-cli.sh -c --commands="/subsystem=jsf/:write-attribute(name=default-jsf-impl-slot,value=mojarra-2.1.23)"

     

    Disable Weld auto inspection

    The remaining part of running Seam 2 on Wildfly 8/9 is disabling autoscanning of deployed archive by Weld.

    Weld is CDI reference implementation and standard which was originally motivated by Seam core framework, so not to conflict between these technologies you need to disable Weld auto scanning of deployed archives. See what you can see if that auto inspection is not disabled Seam 2.3.1 on Wildfly 8.1

     

    You need to change:

    <subsystem xmlns="urn:jboss:domain:weld:2.0"
    
    
    

    to

    <subsystem xmlns="urn:jboss:domain:weld:2.0" require-bean-descriptor="true"/>
    
    
    

    in standalone/configuration/standalone.xml for standalone profile.

     

    And that is all what should be done in case of preparation for your old Seam 2 based application.