How to configure JBoss AS 7.1.x to backward compatibility with older versions

Version 6

            JBoss AS 7 has a modular architecture. It uses JBoss Modules and offers true application isolation.

     

            Imagine the case where you already have applications dependant with an older version and you need to update the module to a newer version and maintain compatibility with legacy applications.

     

            With JBoss AS 7 is possible to have multiple versions (slots) of a given module. In our case, we will configure the org.picketlink module to allow backward compatibility with applications using the 2.0.1 version of PicketLink.

     

            Important Not: Change the version numbers acoording with your need.

     

            To do this follow this steps:

     

              1) Create a new directory ${jboss.home.dir}/modules/org/picketlink/2.0.1;

     

              2) cd ${jboss.home.dir}/modules/org/picketlink/2.0.1;

     

              4) Copy the jar files of PicketLink 2.0.1 to the ${jboss.home.dir}/modules/org/picketlink/2.0.1 directory:

     

        • picketlink-bindings-2.0.1.Final.jar
        • picketlink-bindings-jboss-2.0.1.Final.jar
        • picketlink-fed-2.0.1.Final.jar
        • picketlink-trust-jbossws-2.0.1.Final.jar

     

              5) Edit the module.xml file like this (the same as above, added a attribute named slot):

     

                        <module xmlns="urn:jboss:module:1.1" name="org.picketlink" slot="2.0.1">

                                 <resources>

                                          <resource-root path="picketlink-fed-2.0.1.Final.jar"/>

                                          <resource-root path="picketlink-bindings-2.0.1.Final.jar"/>

                                          <resource-root path="picketlink-bindings-jboss-2.0.1.Final.jar"/>

                                          <resource-root path="picketlink-trust-jbossws-2.0.1.Final.jar"/>

                                 </resources>

     

                                  ...

     

                        </module>

     

              As you can see, the only difference in this version of the module.xml file is a attribute named slot, which we named to 2.0.1.

     

              Now, to use this slot from your applications edit the file META-INF/jboss-deployment-structure.xml that is located inside your WAR (root directory):

     

                        <jboss-deployment-structure>

                               <deployment>

                                      <!-- Add picketlink module dependency -->

                                      <dependencies>

                                             <module name="org.picketlink" slot="2.0.1" />

                                      </dependencies>

                               </deployment>

                        </jboss-deployment-structure>


     

            That is it. Now you have two versions of org.picketlink module, the main version which uses PicketLink's 2.0.2 libraries (if you are using JBoss AS 7.1.1, for example) and a slot named 2.0.1 with the older libraries version.