From f09f2a6c85fd1c69808353eeea97f956d9e9271d Mon Sep 17 00:00:00 2001 From: Mark Payne Date: Tue, 9 Mar 2021 09:10:12 -0500 Subject: [PATCH] NIFI-8212: When instantiating a temp component, ensure that nar class loader is set as the context class loader This closes #4877 Signed-off-by: David Handermann --- .../apache/nifi/nar/StandardExtensionDiscoveringManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/nar/StandardExtensionDiscoveringManager.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/nar/StandardExtensionDiscoveringManager.java index 959a38e79e..6a68bafb0e 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/nar/StandardExtensionDiscoveringManager.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/nar/StandardExtensionDiscoveringManager.java @@ -540,8 +540,8 @@ public class StandardExtensionDiscoveringManager implements ExtensionDiscovering return null; } - try { - final ClassLoader bundleClassLoader = bundle.getClassLoader(); + final ClassLoader bundleClassLoader = bundle.getClassLoader(); + try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(bundleClassLoader)) { final Class componentClass = Class.forName(classType, true, bundleClassLoader); final ConfigurableComponent tempComponent = (ConfigurableComponent) componentClass.newInstance(); initializeTempComponent(tempComponent);