Understanding class loading

In this recipe, we will examine how classes are loaded and the class loader hierarchy typically found in a Java EE server. An understanding of this process also explains the dependencies found between modules. In addition, a class not found type of exception is not uncommon. Understanding the loading process will help resolve these types of errors.

Getting ready

Not all of the application's classes are loaded immediately upon deployment of an application. Classes are generally loaded as needed at runtime when a client needs it. When an instance of a class is created, the class must be in memory.

It is not uncommon for an application to generate a ClassNotfoundException or a ClassNoDefException during execution. Thus, ...

Get EJB 3.1 Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.