Show Table of Contents
3.7. Class Loading and Subdeployments
3.7.1. Modules and Class Loading in Enterprise Archives
Enterprise Archives (EAR) are not loaded as a single module like JAR or WAR deployments. They are loaded as multiple unique modules.
The following rules determine what modules exist in an EAR.
- Each WAR and EJB JAR subdeployment is a module.
- The contents of the
lib/directory in the root of the EAR archive is a module. This is called the parent module.
These modules have the same behavior as any other module with the following additional implicit dependencies:
- WAR subdeployments have implicit dependencies on the parent module and any EJB JAR subdeployments.
- EJB JAR subdeployments have implicit dependencies on the parent module and any other EJB JAR subdeployments.
No subdeployment ever gains an implicit dependency on a WAR subdeployment. Any subdeployment can be configured with explicit dependencies on another subdeployment as would be done for any other module.
The implicit dependencies described above occur because JBoss EAP 6 has subdeployment class loader isolation disabled by default.
Subdeployment class loader isolation can be enabled if strict compatibility is required. This can be enabled for a single EAR deployment or for all EAR deployments. The Java EE 6 specification recommends that portable applications should not rely on subdeployments being able to access each other unless dependencies are explicitly declared as
Class-Pathentries in the
MANIFEST.MFfile of each subdeployment.