2 Replies Latest reply on Sep 22, 2011 8:57 AM by mark boletti

    Extensions vs modules

    mark boletti Newbie

      Hi all JBoss gurus,

      in the application server configuration, the core server modules are mentioned as "extensions". I wonder what is the difference between a module and an extension. For example we use extensively in all our applications the iText library for converting files into PDF. Should I install it as extension ? does it need additional files to be installed as extension ?

      Thanks a lot


        • 1. Re: Extensions vs modules
          Daniel Bevenius Master


          I wonder what is the difference between a module and an extension.

          An extension is an extension to the application server. For example, the subsystems that add functionality to the server are developed as extensions, like web, transactions, weld, etc. Since AS7 is using JBoss Modules and modules are how code is packaged, these extensions are also packaged as modules. Now, if you need to use the iText library from your applications you can install it as a module and declare a dependency from your applications that use it.


          As far an I know, you have two options when it comes to installing modules. You can either have a static module that you install to the filesystem like the ones that are shipped with AS7 in the modules directory, or you can package you module as a jar and deploy it to the applications server.


          For option one you can either add a folder named 'com/itextpdf/itextpdf/main' to the modules directory, or create an external directory where you install your own modules to keep them separate from the modules that are shipped with the server. The contents of the main directory should be the itext jar and a module.xml file. You copy any of the existing module.xml and modify it to suite your needs. 


          For option two, you create a jar with the iText library and add a META-INF/jboss-deployment-structure.xml file which defines the module. Is migth look something like this:


              <module name="deployment.itextpdf.itextpdf">
                      <resource-root path="itextpdf.jar"/>
                      <module name="org.apache.log4j"/>

          I'm not sure what dependencies itextpdf might have but left this in there just as an example.

          By packing the module as a jar and deploying as the advantage that you don't have to manually install the module to every servers filesystem.


          You then declare a dependency by updating your apps and add the following header to your META-INF/manifest.mf file:

          Dependencies: com.itextpdf.itextpdf


          If all your applications use this library you might consider adding this module as a global module in which case this is added automatically to all deployments:


           <subsystem xmlns="urn:jboss:domain:ee:1.0">
                          <module name="com.itextpdf.itextpdf"/>


          If you need a reference for the above suggestions you can find them in the section "Dependency upon custom module" here


          Hope this helps





          2 of 2 people found this helpful
          • 2. Re: Extensions vs modules
            mark boletti Newbie

            Thanks for the details reply Daniel!