Chapter 5. JOnAS Class Loader Hierarchy

This chapter is for the EAR application provider; that is, the person in charge of developing the J2EE application components on the server side. It describes a new and important key feature of the J2EE integration: the class loader hierarchy in JOnAS.

5.1. Understanding the Class Loader Hierarchy

An application is deployed by its own class loader. This means, for example, that if a WAR and an EJB JAR are deployed separately, the classes contained in the two archives are loaded with two separate classloaders with no hierarchy between them. Thus, the EJBs from within the JAR will not be visible to the Web components in the WAR.

This is not acceptable in cases where the Web components of an application need to reference and use some of the EJBs.

For this reason, prior to EAR files, when a Web application had to be deployed using EJBs, the EJB JAR had to be located in the WEB-INF/lib directory of the Web application.

Currently, with the J2EE integration and the use of the EAR packaging, class visibility problems no longer exist and the EJB JAR is no longer required to be in the WEB-INF/lib directory.

The following sections describe the JOnAS class loader hierarchy and explain the mechanism used to locate the referenced classes.