Github user jtstorck commented on a diff in the pull request:
https://github.com/apache/nifi/pull/1539#discussion_r103770451
--- Diff:
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/nar/ExtensionManager.java
---
@@ -199,8 +199,20 @@ public static ClassLoader getClassLoader(final String
classType, final String in
// then make a new InstanceClassLoader that is a full copy of
the NAR Class Loader, otherwise create an empty
// InstanceClassLoader that has the NAR ClassLoader as a parent
if (requiresInstanceClassLoading.contains(classType) &&
(registeredClassLoader instanceof URLClassLoader)) {
- final URLClassLoader registeredUrlClassLoader =
(URLClassLoader) registeredClassLoader;
- instanceClassLoader = new
InstanceClassLoader(instanceIdentifier, classType,
registeredUrlClassLoader.getURLs(), registeredUrlClassLoader.getParent());
+ final Set<URL> classLoaderResources = new HashSet<>();
+
+ // if the registered class loader is a NAR class loader
then walk the chain of class loaders until
+ // finding a non-NAR class loader, and build up a list of
all URLs along the way
+ while (registeredClassLoader != null &&
registeredClassLoader instanceof NarClassLoader) {
+ final NarClassLoader narClassLoader = (NarClassLoader)
registeredClassLoader;
+ for (URL classLoaderResource :
narClassLoader.getURLs()) {
+ classLoaderResources.add(classLoaderResource);
+ }
+ registeredClassLoader = narClassLoader.getParent();
+ }
--- End diff --
@olegz This PR will be updated with a different approach. This change will
be reverted, overall.
---
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.
---