Summary: | Loading DynamicProxys from session | ||
---|---|---|---|
Product: | Tomcat 4 | Reporter: | Martin Harm <martin.harm.42> |
Component: | Catalina | Assignee: | Tomcat Developers Mailing List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P3 | ||
Version: | 4.1.18 | ||
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | All |
Description
Martin Harm
2003-08-01 07:46:48 UTC
I'd prefer something along the lines of the patch below. Could you test this (or attach a simple test case to this bug report). If it works, I'll commit it. Index: catalina/src/share/org/apache/catalina/util/CustomObjectInputStream.java =================================================================== RCS file: /home/cvs/jakarta-tomcat- catalina/catalina/src/share/org/apache/catalina/util/Cu stomObjectInputStream.java,v retrieving revision 1.3 diff -u -r1.3 CustomObjectInputStream.java --- catalina/src/share/org/apache/catalina/util/CustomObjectInputStream.java 27 Feb 2004 14:58:50 -0000 1.3 +++ catalina/src/share/org/apache/catalina/util/CustomObjectInputStream.java 16 May 2004 13:35:18 -0000 @@ -72,5 +72,27 @@ return Class.forName(classDesc.getName(), false, classLoader); } + /** + * Return a proxy class that implements the interfaces named in a proxy + * class descriptor. Do this using the class loader assigned to this + * Context. + */ + protected Class resolveProxyClass(String[] interfaces) + throws IOException, ClassNotFoundException { + + ClassLoader originalClassLoader = + Thread.currentThread().getContextClassLoader(); + + // Set thread to use context class loader + Thread.currentThread().setContextClassLoader(classLoader); + + // Use super class to do all the real work + Class clazz = super.resolveProxyClass(interfaces); + + // Swap back to original class loader + Thread.currentThread().setContextClassLoader(originalClassLoader); + + return clazz; + } } My sugested patch above doesn't work. However, I have committed an alternative patch that does. The patch was also ported to TC5.5.x |