Classloader policies

The number and function of the application and application module classloaders depends on the classloader policies specified in the server and applcation configuration. Classloaders provide multiple options for isolating applications and modules to enable different application packaging schemes to run on an application server.

Two classloader policies control the isolation of applications and modules:

Note: Application client modules are not loaded by application classloaders.

Example scenarios

For each application server in the system, you can set the application classloader policy to SINGLE or MULTIPLE. When the application classloader policy is set to SINGLE, then a single application classloader loads all dependency JAR files in the system. When the application classloader policy is set to MULTIPLE, then each application receives its own classloader used for loading that application's dependency JAR files.

This application classloader can load each application's Web modules if that WAR module's classloader policy is also set to APPLICATION. If the WAR module's classloader policy is set to APPLICATION, then the application's loader loads the WAR module's classes. If the WAR classloader policy is set to MODULE, then each WAR module receives its own classloader.

This example shows that when the application classloader policy is set to SINGLE, a single application classloader loads all dependency JAR files of all applications on the server. The single application classloader can also load Web modules if an application has its WAR classloader policy set to APPLICATION. Applications having a WAR classloader policy set to MODULE use a separate classloader for Web modules.

Application classloader policy: SINGLE

Application 1
	Module:	WAR1.war
	 	MANIFEST Class-Path: Dependency1.jar
		WAR Classloader Policy = MODULE
Application 2  
	Module:	WAR2.war
		WAR Classloader Policy = APPLICATION
		MANIFEST Class-Path: Dependency2.jar

This example shows that when the application classloader policy is set to SINGLE, a single application classloader loads all dependency JAR files of all applications on the server.

This example shows that when the application classloader policy of an application server is set to MULTIPLE, each application on the server has its own classloader. An application classloader also loads its Web modules if the application's WAR classloader policy is set to APPLICATION. If the policy is set to MODULE, then a Web module uses its own classloader.

Application classloader policy: MULTIPLE

Application 1
	Module:	WAR1.war   
		MANIFEST Class-Path: Dependency1.jar
		WAR Classloader Policy = MODULE
Application 2  
	Module:	WAR2.war
		WAR Classloader Policy = APPLICATION
		MANIFEST Class-Path: Dependency2.jar

This example shows that when the application classloader policy of an application server is set to MULTIPLE, each application on the server has its own classloader