Loading application server modules

Loading application server modules

Learning more about JBoss module is essential if you want to understand the next chapters that discuss about the server configuration. Basically, each module is a pluggable unit. As depicted by the following picture. JBoss modules can load libraries using two approaches:

  • Using a static file system
  • Using direct JAR executionScreenshot_12

Using a static file system approach is the simplest way to load a module, and it’s used as a default when starting up the application server. It is based on the assumption that the filesystem reflects the name and version of modules used. All you need to provide to the environment is the location where modules are stored. So, for example, you could start a standalone instance of JBoss AS 7 using the following command:

java -jar jboss-modules.jar -mp “%JBOSS_HOME%\modules” org.jboss.as.standalone

The argument module path (-mp) actually points to the root directory (or directories), which will be searched by the default module loader for module definitions. A module is defined using a simple XML descriptor, like this:

<module xmlns=”urn:jboss:module:1.0″ name=”org.jboss.msc”>

<main-class name=”org.jboss.msc.Version”/>


<resource-root path=”jboss-msc-1.0.0.Beta8.jar”/>



<module name=”javax.api”/>

<module name=”org.jboss.logging”/>

<module name=”org.jboss.modules”/>



Basically, a module definition contains two main elements: the resources defined in the module (and their path) and the module dependencies . The previous example is the module definition for the JBoss MSC module which is contained in the jboss-msc-1.0.0.Beta8.jar file and bears a dependency on javax.api, org.jboss.logging and org.jboss.modules module.


A module which is defined with a main-class element is said to be executable. In other words, the module name can be listed on the command line, and the standard static main(String[]) method in the named module’s main-class will be loaded and executed.

The other way to approach the module repository is by using direct JAR execution . This means that the module information, such as its dependencies, is contained in the MANIFEST file.

When the module is executed as a JAR file you just need to provide the name of your application module, which is packed in JAR file, and it will be picked up by JBoss modules:

java -jar jboss-modules.jar -jar your-app.jar

Then, in your application.jar, you might specify a set of module definitions, much the same way you did for flat filesystem modules. These definitions are contained in the META-INF/MANIFEST.MF file:

Main-Class: mypackage/MyClass

Dependencies: org.jboss.logging

0 Responses on Loading application server modules"

Leave a Message

Your email address will not be published. Required fields are marked *

Copy Rights Reserved © Mindmajix.com All rights reserved. Disclaimer.