Hi!
I have a couple bundles each of which includes a groovy class loader which
uses the thread context
classloader as its parent class loader. The idea is to run groovy scripts
in the class loading context
of each bundle. So bundle A which imports C, D, & E bundles would allow a
groovy script compiled
and executed in the context of bundle A to see classes from A, C, D, & E.
Groovy scripts running in bundle B would see a different set of classes
(possibly different versions of C, D, or E).
I am using karaf 2.3.1, aries blueprint 1.0.0, & spring 3.0.7.
I have been having issues getting the right parent classloader for the
groovy classloader.
I have seen the following:
a) Groovy classloader is created by a class created as an OSGi
service
o Using thread context classloader as the parent loader, the
groovy classloader sees all
classes exported from all bundles [not just those imported by
the bundle]
o Using class.getClassloader() as the parent loader, the groovy
classloader does not see
classes imported by the bundle.
b) Groovy classloader is created on the fly as a request is processed
o Using the thread context classloader as the parent, the groovy
classloader does not see
classes imported by the bundle.
Using the one classloader, most things work but if multiple versions of
classes are used within the container the wrong class could be used. Also,
if the bundle is reloaded references to classes loaded
previously cause class cast exceptions.
Is it possible to get a parent classloader for the groovy compiler that will
get me the bundle's classpath?
Thanks in advance,
-Doug
--
View this message in context:
http://karaf.922171.n3.nabble.com/bundle-specific-classloaders-tp4034883.html
Sent from the Karaf - User mailing list archive at Nabble.com.