How to install a module on WildFly / JBoss EAP

Installing a module on WildFly / JBoss EAP requires creating a path under the JBOSS_HOME/modules folder. Under this path, you will install the JAR libraries which are part of the module and a module.xml file which describes the module itself and dependencies with other module.

Example1: Manually creating the module for Quartz library:

Create the following path under the JBOSS_HOME:

$ mkdir -p $JBOSS_HOME/modules/org/quartz/main

 Now include in the main folder the XML descriptor of the module (module.xml) and the JAR files. Here’s a view of your modules structure:

This is a sample module.xml configuration for your module:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="org.quartz">
      <resource-root path="quartz-all-2.0.2.jar" />
      <module name="org.slf4j" />
      <module name="javax.api" />

This basically says that the module has a dependency on the other modules: org.slf4j (logging framework) and javax.api module.

Example2: Using the CLI to create the “org.postgres” module:

$ module add --name=org.postgres --resources=postgresql-42.2.5.jar --dependencies=javax.api,javax.transaction.api

That will result in the following structure created under your modules folder:


The module.xml file is already configured with the required dependencies in place:

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="org.postgres">
    <resource-root path="postgresql-42.2.5.jar"/>
    <module name="javax.api"/>
    <module name="javax.transaction.api"/>

Using properties in your module

Besides declaring dependencies, you can also specify some System Properties, so that they are loaded up when the module is available. Here’s an example:

<module xmlns="urn:jboss:module:1.1" name="com.mymodule" >

        <property name="" value="property.value"/>

        <resource-root path="my-module-1.0.jar"/>


How to use a Module in your application

In order to use this module in your applications you have to trigger a dependency on the module. This can be done by adding into the META-INF/MANIFEST.MF file a Dependency [modulename]


Dependency: org.quartz						

How to define a global module

It is also possible to set up global modules, that are accessible to all deployments. This is done by modifying the configuration file (standalone/domain.xml).
For example, to add javassist to all deployments you can use the following XML in your standalone.xml/domain.xml

<subsystem xmlns="urn:jboss:domain:ee:1.0" >            
    <module name="org.javassist" slot="main" />            

Note that the slot field is optional and defaults to main.

If you want to learn more about modules installation, check out the next tutorial which shows how to install different releases of a module using module slots.

Please notice that, since WildFly 19, you can also use global directories in your configuration: Configuring global modules and directories in WildFly