Jboss Module Slot
- 4Naming Conventions
- 5Process
- How to create custom Modules in JBoss EAP 6 https://access.redhat.com/solutions/195403
JBoss Enterprise Application Platform; JBEAP-12467 (7.1.0) Module naming does does not support slots. Suppose following additional slot JSF configuration: modules/com/ `- sun `- jsf-impl `- mojarra-2.2.4 - jsf-impl-2.2.4-jbossorg-1.jar - module.xml modules/javax/ `- faces `- api `- mojarra-2.2.4 - jboss-jsf-api2.2spec-2.2.4.jar - module.xml When you start server having following configuration: you won't be able to deploy any JSF. The easiest way to see which modules are dependent on javax.validation.api and force it to be included, even though it was excluded, is to search your.xml files in JBOSSDIRECTORY/modules for javax.validation.api, the modules that are dependent have something like that in module.xml.
- https://github.com/NovaOrdis/playground/tree/master/jboss/wildfly/custom-module
Module Name
The module name is a dot-separated, fully qualified, unique, package name-like string. Conventionally, the name of the module coincides with the embedded top package, though nothing bad seems to happen it does not. Example: com.novaordis.playground.wildfly.custommodule.
Module JAR Name
Conventionally, it should be the condensed form of the module name, including the version string. Example custom-wildfly-module-1.0.jar.
Module Location
Write Code and Package It According the Naming Conventions
See Naming Conventions above.
Copy the JAR under WildFly's module Directory
See Module Location above.
Create a module.xml in the Same Module Directory
The content of the module.xml should be similar to:
Module's Dependencies
The module may have its own dependencies, which can be other JBoss modules, third party packages or JDK classes. Those must be declared as shown here:
- Expressing Module Dependencies in module.xml
Make the Module Dependents Aware
In case of a web application, place a jboss-deployment-structure.xml similar to the example shown below under WEB-INF:
Create the EAP module as artifact of a dedicated 'eap-module' Maven module:
- Deploying a Module with CLI
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:
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 basically says that the module has a dependency on the other modules: org.slf4j (logging framework) and javax.api module.
Jboss Global Module Slot
Example2: Using the CLI to create the 'org.postgres' module:
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:
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:
Jboss-deployment-structure Module Slot
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]
Example:
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
Note that the slot field is optional and defaults to main.
Jboss Module Sloth
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.
Jboss Module Slots
Please notice that, since WildFly 19, you can also use global directories in your configuration: Configuring global modules and directories in WildFly