Hi all,
I am using a RequestDispatcher to do a cross context include to a JSP. The
problem is there seems to be a problem in the JasperLoader implementation.
Let me explain quickly the configuration :
contextA :
- does a
getContext("/contextB").getRequestDispatcher("path/file.jsp").include(request,
response) call
contextB :
- contains the path/file.jsp file that contains an @page
import="com.xo3.MyClass" and of course uses the MyClass class...
- contains the WEB-INF/classes/com/xo3/MyClass
When the dispatch occurs, the JSP file is compiled and executed, but it
complains that it can't load the MyClass class. I suspect the following
lines in src\jasper\src\share\org\apache\jasper\servlet\JasperLoader.java :
// Class is in a package, delegate to thread context class loader
if( !name.startsWith(Constants.JSP_PACKAGE_NAME) ) {
ClassLoader classLoader = null;
if (System.getSecurityManager() != null) {
classLoader =
(ClassLoader)AccessController.doPrivileged(privLoadClass);
} else {
classLoader =
Thread.currentThread().getContextClassLoader();
<----------------------------------------------------
}
clazz = classLoader.loadClass(name);
if( resolve )
resolveClass(clazz);
return clazz;
}
The problem here is that from what I understand from the source the current
thread context class loader is never changed from contextA to contextB. So
that when JasperLoader executes in contextB, it actually tries to load
classes using the class loader of contextA.
Did I miss something in configuration or is this a bug ?
Best greetings,
Serge Huber.
[EMAIL PROTECTED]