Home  >  Blog  >   JBoss  > 

Loading application server modules-JBoss

Rating: 4
  
 
2184
  1. Share:
JBoss Articles

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” org.jboss.as.standalone

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.

MindMajix Youtube Channel

Note

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

 

Join our newsletter
inbox

Stay updated with our newsletter, packed with Tutorials, Interview Questions, How-to's, Tips & Tricks, Latest Trends & Updates, and more ➤ Straight to your inbox!

Course Schedule
NameDates
JBoss TrainingMar 21 to Apr 05
JBoss TrainingMar 25 to Apr 09
JBoss TrainingMar 28 to Apr 12
JBoss TrainingApr 01 to Apr 16
Last updated: 20 March 2023
About Author
Remy Sharp
Ravindra Savaram

Ravindra Savaram is a Content Lead at Mindmajix.com. His passion lies in writing articles on the most popular IT platforms including Machine learning, DevOps, Data Science, Artificial Intelligence, RPA, Deep Learning, and so on. You can stay up to date on all these technologies by following him on LinkedIn and Twitter.