2 of 2 people found this helpful
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:
<jboss-deployment-structure> <module name="deployment.itextpdf.itextpdf"> <resources> <resource-root path="itextpdf.jar"/> </resources> <dependencies> <module name="org.apache.log4j"/> </dependencies> </module> </jboss-deployment-structure>
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:
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"> <global-modules> <module name="com.itextpdf.itextpdf"/> </global-modules> </subsystem>
If you need a reference for the above suggestions you can find them in the section "Dependency upon custom module" here
Hope this helps
Thanks for the details reply Daniel!