Chapter 30: Configuring Custom Java Class Lists  Configuring an entity’s custom class list

Chapter 30: Configuring Custom Java Class Lists

Deciding which classes to add to the custom list

Since system loaded classes require a server restart to update, use system loading only for classes that never change. For classes that might be refreshed with a component or Web application, add the classes to the custom list. The following sections give more specific guidelines for each entity type.


Custom class lists for Java and EJB components

The standard locations for deploying Java and EJB component class files is the java/classes directory. EAServer also generates the component’s stubs and skeleton classes under this directory.

A Java component’s implementation class and stub classes are automatically part of the custom class list for the component. Add the following additional classes to the custom list:

Component-specific JAR files should be deployed in the EAServer java/classes subdirectory and added to the custom class list.

To configure the custom list, follow the instructions in “Configuring an entity’s custom class list”.

NoteJNDI classes EAServer never custom loads the standard Java Naming and Directory (JNDI) packages. In EAServer versions prior to 4.0, an EJB component required the following in the custom class list:

com.sybase.ejb.*;javax.naming.*;javax.naming.spi.*

In EAServer 4.0 and later, these classes and interfaces are ignored when listed in the custom class list.


Class loading order for components

When loading classes listed in a Java or EJB component custom list, the component class loader searches for classes in this order:

  1. Any JAR file that is listed in the component’s custom class list property and deployed in the EAServer java/classes subdirectory.

  2. Classes listed in the component’s custom class list and deployed under the EAServer java/classes subdirectory.

  3. Classes listed in the component’s custom class list and deployed under the EAServer html/classes subdirectory.

  4. Any JAR file that is listed in the component’s custom class list property and deployed in the EAServer java/lib subdirectory.

  5. If the class is not loaded at this point, it is loaded by the system loader using the search order specified in the server class path—see “The system class loader”.


Custom class lists for Web applications

A Web application’s custom class list must include any classes that must be reloaded when the Web application is refreshed. For example, servlet implementation classes, utility classes called by servlets and JSPs, and stub classes for component invocations should be in the custom class list.

If you deploy classes and JAR files that the standard Web application deployment locations, you do not need to explicitly list them in the custom class list. The standard Web application deployment locations are under your Web application’s context root, the EAServer subdirectory:

Repository/WebApplication/WebApp

Where WebApp is the Web application name. Deploy classes and JAR files to these subdirectories of the context root:

EAServer automatically adds classes and JAR files that are deployed in the standard locations to the custom class list. Use these locations to deploy classes and JAR files that are specific to your Web application. These directories are equivalent to the like-named directories in a J2EE WAR file.

For classes that are also used in EJB or Java components or other Web applications, you can deploy classes or JAR files in one of the locations below. For example, if your servlet calls an EJB component, you may want the servlet and component to use the same copies of the component stub classes. You must explicitly list these classes or JAR files in your Web application’s custom class list:

Though a component and Web application may custom load the same classes, to enable sharing of one copy of each class, you must configure the same custom class list entries in parent entities up to a common ancestor entity, as described in “Custom class lists for packages, applications, or servers”.


Class loading order for Web applications

EAServer loads classes listed in the Web application custom class list by searching the following code bases, in the order specified. All of these locations are subdirectories of your EAServer installation directory, app_name represents the name of your Web application, and server is the server where the Web application is installed. If the custom class loader cannot locate a class file, the server attempts to load it using the system class loader.

  1. Class files in work/server/Servlet/WebApp-app_name

    This directory contains generated servlet classes for compiled JSPs.

  2. Class files in Repository/WebApplication/app_name/WEB-INF/classes

    This is the standard directory for servlet, filter, tag-library, and utility classes used by the Web application. If utility classes are shared with Java components running on the same server, you may wish to move them to the EAServer java/classes subdirectory and add them to the custom class list for your application or server.

  3. JAR files in Repository/WebApplication/app_name/WEB-INF/lib

    This is the standard location for JAR files that contain classes to be used only by this Web application. EAServer searches the JAR files in the order specified by the com.sybase.jaguar.webapplication.jarlist property. If you do not JAR files in this property, EAServer searches in directory order; that is, the order that would be returned in a directory listing.

  4. JAR files in extensions

    This directory contains JAR files that have been installed as Web application extensions—see “Using Java extensions”. EAServer places these JAR files in the Web application’s default custom class list, in directory order.

  5. JAR files in the java/classes directory that are listed in the custom class list for the servlet, JSP, or Web application.

  6. Class files in the java/classes and html/classes directory that are specified in the custom class list for the servlet, JSP, or Web application.

  7. JAR files in the java/lib directory that are listed in the custom class list for the servlet, JSP, or Web application.

  8. If the class has not been found, the server attempts to load the class using the system class loader, using the search order in the server class path—see “The system class loader”.


Custom class lists for servlets installed directly in the server

For servlets that are installed directly in a server, and not in a Web application, you must define the custom class list in the servlet properties or the properties of the host server. Classes and JAR files for these servlets should be deployed in the EAServer java/classes subdirectory.


Custom class lists for packages, applications, or servers

You can configure the package, application, or server level class lists to configure sharing of class instances between child entities installed in the package, application, or server. Doing so can decrease server memory use by eliminating copies of custom loaded classes. However, you must also refresh the classes at the level where they are loaded. For example, classes loaded at the server level require a refresh of the entire server.

To configure sharing of custom-loaded classes, first configure the class lists for the Web applications and components that use the class directly, then configure the same entries in the parent entries up to a common ancestor. Make sure the class loader delegation policy is Parent First for entities below this common ancestor. For example, Figure 30-2 shows the entries required to share classes in the JAR file widget.jar and the Java package com.sybase.widgets, loading one copy of the classes at the application level.

Figure 30-2: Example of sharing custom loaded classes

Deploy classes that are shared by multiple entities in one of these common locations:

To configure the server, application, or package class list, follow the instructions in “Configuring an entity’s custom class list”.





Copyright © 2005. Sybase Inc. All rights reserved. Configuring an entity’s custom class list