Github user neykov commented on a diff in the pull request:
https://github.com/apache/incubator-brooklyn/pull/90#discussion_r15458566
--- Diff: core/src/main/java/brooklyn/management/ha/OsgiManager.java ---
@@ -108,11 +108,22 @@ public void registerBundle(String bundleUrl) {
if (bundleNameVersion==null) {
bundleNameVersion = bundleUrlOrNameVersionString;
}
-
+
Maybe<Bundle> bundle = Osgis.getBundle(framework,
bundleNameVersion);
if (bundle.isPresent()) {
- @SuppressWarnings("unchecked")
- Class<T> clazz = (Class<T>)
bundle.get().loadClass(type);
+ Bundle b = bundle.get();
+ Class<T> clazz;
+ //Extension bundles don't support loadClass.
+ //Instead load from the app classpath.
+ if (Osgis.isExtensionBundle(b)) {
+ @SuppressWarnings("unchecked")
+ Class<T> c = (Class<T>)Class.forName(type);
--- End diff --
Extension bundles are almost identical to the previous approach we used.
Their goal is to direct Felix to use the app's classloader. The only difference
is that now the container knows the name:version of the code that is on the
classpath and will deny requests to install external bundles with matching
name:version.
Felix still doesn't know for the existence of our bundle-A, we just tell it
that the Export-Package list in the extension bundle should be looked for in
the app's classpath. We don't ever install bundle-A in Felix. There is a
hardcoded check that throws on an attempt to bundle.loadClass from extension
bundle.
With that in mind, yes the code deliberately ignores extension bundles and
goes directly for the app's classloader.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---