Loading application server modules-JBoss

  • (4.0)

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 execution

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”

Learn how to use JBOSS, from beginner basics to advanced techniques, with online video tutorials taught by industry experts. Enroll for Free JBOSS Training Demo!

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:

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

Frequently asked Jboss Interview Questions

Popular Courses in 2018

Get Updates on Tech posts, Interview & Certification questions and training schedules