Module Visibility causes ClassNotFoundException
 Technote (FAQ)
 
Problem
An ear file will work correctly with Application Visibility, but not Module Visibility.
 
Cause
A clear understanding of visibility can help you avoid unexpected classloader problems.
 
Solution
With module visibility set, each piece of the EJB is given a separate classloader when more than one EJB shares dependencies. When a single EJB uses the dependencies, then the EJB classloader loads the jars.

The pieces are the EJB itself and the jars that it is dependent upon, which are called helpers. When there are multiple classloaders involved, these classloaders are visible in a hierarchical way. The EJB classloader is able to see the classes loaded by the helper classloaders. However, this only works at one level. If a helper jar has a dependency on another jar, it will not be able to be loaded because the helper classloaders do not have visibility of each other.

One solution is to use Application Visibility, which uses a single classloader for the application. The EJB classes and the helper classes will be visible to every class in the application.

Another solution is use Module Visibility and to build the helper jars with no other dependencies among themselves. At runtime, the EJB will not have visibility of the classes in the Web application.

 
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > Classloader
Operating system(s): Windows
Software version: 4.0.2
Software edition:
Reference #: 1111472
IBM Group: Software Group
Modified date: Sep 15, 2004