Browse Prior Art Database

Efficient and dynamically extensible classpath management for Java Application Servers. Disclosure Number: IPCOM000013876D
Original Publication Date: 2000-Dec-01
Included in the Prior Art Database: 2003-Jun-18

Publishing Venue



A Java* Application Server supporting servlets and Java server pages or an Enterprise Java Beans* (EJB) server provides the facility to deploy new applications into a running system. There may be a large number of applications installed on any one system. This creates a large number of archive files (known as Jar files) containing Java class files for the installed applications . When the application server receives a client request it needs to load the Java classes required to service that request. It does this by searching the Jars in its classpath. In a simple implementation, every Jar file deployed in the system is added to the classpath. This makes searching for classes within those Jars at runtime a lengthy operation since there are many potential Jars to be examined. It is also desirable for a Java Virtual Machine* (JVM) within the application server to be able to dynamically pick up newly installed Jar files without interrupting application service. The requirement therefore is to keep the classpath as small as possible for fast loading of classes, retaining the ability to dynamically extend it without bringing down the server or restarting any running JVMs the server may be using. The problem is solved by keeping an in-memory (persistent if required) hash-table independent of any JVM, called the "Jar Map." When a new Jar file is deployed in the running system the server adds an entry into the Jar Map for every class (and potentially other resources) in the Jar. The entry maps fully qualified class or resource name to the Jar from which it came. When the server first starts it contains only system classes in its classpath. A server provided ClassLoader, called the "Application ClassLoader", is used to load all application classes. When a request is received to be processed by the server the JVM will attempt to load the target class using the Application ClassLoader where logic is as follows: try to load the given class if load fails with "ClassNotFoundException" then lookup class name in Jar Map if class name found in Jar Map then add resulting Jar to Application ClassLoader classpath try to load the given class if load fails then throw ClassNotFoundException else throw ClassNotFoundException done