On Fri, Mar 30, 2012 at 5:54 PM, Jochen Wiedmann <[email protected]> wrote: > 2012/3/30 Holger Hoffstätte <[email protected]>: > >> I don't know if that is "what you want" (or not), but it is certainly not >> what would happen. :) The Bundles will be installed into the framework as >> if installed "manually", and each will have its own classloader. >> Essentially you will play the role of a deployment agent, which means you >> will also be responsible for starting, stopping and eventually >> uninstalling the bundles, as necessary. > > What I want is a new ClassLoader with all those bundles and the given parent.
You can't do that. When you install a bundle it gets a BundleClassloader that gets wired to other bundle's classloaders according to it's import directives and the Parent/System classloader for boot delegation. Having one specified parent classloader kind of defies the purpose. Have a look at the OSGi specification for an explanation of the class loading architecture. What you can do is use an approach like the PAX swissbox BundleClassLoader [0] which takes a parent to consult first, but that still will not make the bundles classloader delegate back to it when it needs to load a class not physically inside the jar. Regards, Bram [0] https://github.com/ops4j/org.ops4j.pax.swissbox/blob/master/pax-swissbox-core/src/main/java/org/ops4j/pax/swissbox/core/BundleClassLoader.java using Bundle as the framework will wire them up to the > Jochen > > > -- > "Bildung kommt von Bildschirm und nicht von Buch, sonst hieße es ja Buchung." > Dieter Hildebrandt > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

