You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by bu...@apache.org on 2004/01/17 13:32:21 UTC
DO NOT REPLY [Bug 26215] New: -
ClassUtils.loadClass() loses classloaders for classes in certain circustances
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26215>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26215
ClassUtils.loadClass() loses classloaders for classes in certain circustances
Summary: ClassUtils.loadClass() loses classloaders for classes in
certain circustances
Product: Axis
Version: 1.1
Platform: All
OS/Version: All
Status: NEW
Severity: Normal
Priority: Other
Component: Serialization/Deserialization
AssignedTo: axis-dev@ws.apache.org
ReportedBy: penko@rila.bg
The situation appears with Arrays of Object when they are loaded.
When I publish the service into the Axisi Engine I change the
contextClassLoader (My services come with a different classloader):
ClassLoader classLoader = serviceClass.getClassLoader();
ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader
();
Thread.currentThread().setContextClassLoader(classLoader);
. . .. .
So now everyting is fine as the classes that are publishted are loaded with the
contextClassLoader, returning the old context class loader the published
classes cannot be used.
So I made the following change in the ClassUtils.loadClass() line 183:
try {
// Try the context class loader
Object foundObj;
ClassLoader classLoader =
Thread.currentThread().getContextClassLoader();
foundObj = Class.forName(className, true, classLoader);
// SET THE CLASS LOADER FOR THIS CLASS
setClassLoader(className, Thread.currentThread().getContextClassLoader
());
return foundObj;
} catch (ClassNotFoundException cnfe2) {
....................
Now when the class is loadeded once it remains in the list of loaded classes
with its classloader