Each server, component, Web application, application, and package has a custom class loader associated with it. The EAServer class loaders have a a parent-child hierarchy. Every class loader except the server class loader has a parent. This relationship is shown in the following figure:
Figure 30-1: EAServer class loader hierarchy
When you specify the same class at multiple levels, the class loader delegation policy determines how version conflicts are resolved. The version 2 class loader supports these settings:
Parent First When loading classes at levels below the server, the entity class loader delegates to it’s parent before trying to load the class itself. For example, if you specify Java package X in a component’s class list, the class list of the package where X is installed, and the class list of the server where the package is installed, the server class loader loads classes in package X.
The Parent First policy is the default. This setting avoids the overhead incurred by custom-loading multiple copies of the same class among sibling entities. This policy allows sharing of common utility classes used by components and Web applications. It also allows sharing class instances that are passed as parameters to EJB local interface calls, which is a required to avoid ClassCastException errors.
Parent Last When loading classes at the levels below the server, the entity class loader tries to load classes itself before delegating to the parent. For example, if you specify Java package X in a component’s class list and the class list of the package where X is installed, the component class loader loads the class. If another component in the same package has the same settings, two copies of the class are loaded.
Use the Parent Last policy when you must load different versions of a class in different entities. For example, in a Web application you may require a different version of a JAR file than that used by the server.
If you use the version 1 class loader, the delegation
policy is always Parent First, regardless of the entity configuration.
You can configure the delegation policy for each component, package, Web application, application. In EAServer Manager, use the Class Loader Policy control on the Java Classes tab in the properties dialog for the entity. If using jagtool or an EAServer configuration file, set the property listed in the Table 30-1.
Entity |
Property name |
---|---|
Component |
|
Package |
|
Web application |
|
Application |
Copyright © 2005. Sybase Inc. All rights reserved. |
![]() |