-
1. Re: Having problem reloading class in the classpool
chiba Jul 31, 2003 11:52 AM (in response to melaraj)First, once get("Point") is called, the ClassPool object
keeps the CtClass object representing the Point class
forever. Even if you remove a class path, the CtClass
object is not removed. So you should create another
ClassPool object.
Second, currently all instances of ClassPool share
a single class loader for executing toClass(). Hence,
you cannot reload a class. Do you think I should
make each instance of ClassPool have a distinct
class loader?
- Chiba -
2. Re: Having problem reloading class in the classpool
melaraj Jul 31, 2003 12:33 PM (in response to melaraj)I think you should allow the ability to have multiple loaders. This will expand your library so that it can be used in a number of new types of systems.
We are looking to allow users to hot deploy and update libraries withouth having to bring down the system.
Manuel -
3. Re: Having problem reloading class in the classpool
chiba Aug 1, 2003 10:26 AM (in response to melaraj)Hmm... if you want to implement hot deploy,
you should not use toClass(). Rather you
should use javassist.Loader or write your own
class loader. For more details, please read
the API document of ClassPool#writeAsClass(Stirng)
and the section 4 of the tutorial.
toClass() is a convenience method; not for complex
work. -
4. Re: Having problem reloading class in the classpool
melaraj Aug 2, 2003 3:10 PM (in response to melaraj)Got it!
I tried writing my own loader. However, whenever a jar containing class is updated. The following error is thrown when trying to define the class:
java.lang.LinkageError: duplicate class definition
I am not sure if what I am looking for is possible. I will update the thread if I come up with something.
Thanks for the help!.
Manuel