Troubleshooting class loaders

Class loaders find and load class files. For a deployed application to run properly, the class loaders that affect the application and its modules must be configured so that the application can find the files and resources that it needs. Diagnosing problems with class loaders can be complicated and time-consuming. To diagnose and fix the problems more quickly, use the administrative console Class Loader Viewer to examine class loaders and the classes loaded by each class loader.

Before you begin

This topic assumes that you have installed an application on a server supported by WebSphere® Application Server and you want to examine class loaders used by the application or its modules. The modules can be Web modules (.war files) or enterprise bean (EJB) modules (.jar files). The Class Loader Viewer enables you to examine class loaders in a runtime environment.

This topic also assumes that you have enabled the class loader viewer service. Click Servers > Application servers > server_name > Class Loader Viewer Service , enable the service and restart the server.

About this task

The runtime environment of WebSphere Application Server uses the following class loaders to find and load new classes for an application in the following order:

  1. The bootstrap, extensions, and CLASSPATH class loaders created by the Java virtual machine
  2. A WebSphere extensions class loader
  3. One or more application module class loaders that load elements of enterprise applications running in the server
  4. Zero or more Web module class loaders
Class loader hierarchy

Each class loader is a child of the previous class loader. That is, the application module class loaders are children of the WebSphere extensions class loader, which is a child of the CLASSPATH Java class loader. Whenever a class needs to be loaded, the class loader usually delegates the request to its parent class loader. If none of the parent class loaders can find the class, the original class loader attempts to load the class. Requests can only go to a parent class loader; they cannot go to a child class loader. After a class is loaded by a class loader, any new classes that it tries to load reuse the same class loader or go up the precedence list until the class is found.

If the class loaders that load the artifacts of an application are not configured properly, the JVM might throw a class loading exception when starting or running that application. Class loading exceptions describes the types of exceptions caused by improperly configured class loaders and suggests ways to use the Class Loader Viewer to correct configurations of class loaders. The types of exceptions include:

The steps that follow describe generally how to use the Class Loader Viewer to examine class loaders and correct problems with application or class loader configurations.

Procedure

What to do next

If you continue to have class loader problems, you might want to run the osgiCfgInit script to clear and recreate the OSGi cache. The Equinox OSGi framework, which is used to manage class loading and relationships between server component bundles, maintains this cache. However, in some cases, the cached bundle data, that is maintained on a per-profile basis, with a separate cache at the WAS_HOME level for installation-wide processes, becomes out of sync with the actual binaries on the server. refer to Class loading exceptions and to Class loading.

You can also refer to the topic Class loading exceptions for other possible solutions.




In this information ...


Related concepts

IBM Redbooks, demos, education, and more

(Index)

Use IBM Suggests to retrieve related content from ibm.com and beyond, identified for your convenience.

This feature requires Internet access.

Task topic Task topic    

Terms and conditions for information centers | Feedback

Last updatedLast updated: Aug 30, 2013 10:47:11 PM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=pix&product=was-nd-iseries&topic=ttrb_classload_viewer
File name: ttrb_classload_viewer.html