-
Oct 27th, 2012, 03:29 AM
#1
LTW for multiple classloaders
Hello!
A few days ago I found out one specific problem. I use LTW in my project, everything was fine till I started using two classloaders (one more classloader is created to load new classes dynamically). So new classes are not woven. I tried to patch parent classloader to load new classes into it, but at the moment I haven't found the solution. It's possible to invoke defineClass() via reflection, but still that approach will fail if a loaded class extends another one from loaded classes. And I don't think it's a good solution to patch the classloader).
My question is how can I add one more classloader for Spring to apply class transformers and use LTW? I know I can invoke .setClassLoader() for ApplicationContext, but it will lose all the classes from the main classloader.
Another solution is to create a patched classloader with overriden loadClass() and findClass() and load it with -Djava.system.class.loader property, but it looks ugly a bit.. 
Yes, I know, that loading classes dynamically by-hand is not a good choice, don't ask me why, I'm looking forward to rewriting it using osgi, but still I'd like to solve that problem.
Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules