In order to allow hot refresh, class references in your servlet and JSP code must be resolved by EAServer’s custom class loader. Class instances loaded by the system class loader cannot be refreshed. Class instances loaded by the custom class loader cannot be assigned to references loaded by the system class loader, or vice-versa.
Most all references will be resolved by the custom loader. The exceptions are references made with class loader calls with an explicit reference to the system class loader or another custom class loader. The following class references are all resolved by the custom class loader when they occur in servlet code:
Classes referenced by import statements and declarations.
Classes loaded dynamically using Class.forName(String). For example:
obj = Class.forName("com.foo.MyClass");
Classes loaded by explicitly calling the java.lang.ClassLoader associated with the servlet instance, which can be retrieved with this code (this refers to the servlet instance):
ClassLoader loader = this.getClassLoader();
Code that uses the system class loader should be rewritten to use the servlet class loader when possible. The system class loader cannot load classes from the Web application WEB-INF/classes or WEB-INF/lib directories unless you add these locations to the server BOOTCLASSPATH and CLASSPATH environment variables. Classes loaded by the system class loader cannot be refreshed while the server is running.
Copyright © 2005. Sybase Inc. All rights reserved. |