I wrote a custom classloader to dynamically load classes
present in a certain directory( *not* present in the CLASSPATH). ( So that I need not restart AppServer, everytime I add a new class)
I am able to succefully load a class( say A.class), *BUT* when that class(A.class) uses other classes(B.class) present in that directory, then it is reporting classnotfound exception.
I believe A.class is delegating the the work of finding B.class to the parent classloader instead of the "custom classloader".
Is there any method, by which you can force a class to use the custom classloader or anything like that. Can anyone pls advise/suggest me what whould be a right approach
-
Java Classloader (1 messages)
- Posted by: Puru Kk
- Posted on: May 06 2002 14:57 EDT
Threaded Messages (1)
- Java Classloader by Robert Patton on May 06 2002 20:09 EDT
-
Java Classloader[ Go to top ]
- Posted by: Robert Patton
- Posted on: May 06 2002 20:09 EDT
- in response to Puru Kk
Try setting your classloader as the context class loader for the thread you are in, and have your loader use the system loader as a parent and delegate for classes it can't find. Of course, if you are running in an EJB container you have to be careful not to do any of this from within an EJB or you are going against the spec.