https://github.com/apache/nifi/pull/5830

It works with the tests and a live NiFi test on Java 8 and 11. Caveat:
it adds about 60MB of dependencies to the scripting bundle. Should I
hide it behind a Maven profile?

On Wed, Mar 2, 2022 at 4:34 PM Mike Thomsen <[email protected]> wrote:
>
> Ugh... looks like I might have figured it out. Apparently you have to
> ALSO add the compiler package (not just the "embeddable compiler
> client" dependency)?
>
> On Wed, Mar 2, 2022 at 4:28 PM Mike Thomsen <[email protected]> wrote:
> >
> > Was able to trap this in Intellij IDEA when debugging a unit test:
> >
> > java.lang.NoClassDefFoundError:
> > org/jetbrains/kotlin/config/KotlinCompilerVersion
> >
> > at 
> > org.jetbrains.kotlin.cli.common.repl.KotlinJsr223JvmScriptEngineFactoryBase.getLanguageVersion(KotlinJsr223JvmScriptEngineFactoryBase.kt:26)
> > at 
> > org.apache.nifi.script.ScriptingComponentHelper.getScriptLanguageAllowableValue(ScriptingComponentHelper.java:281)
> > at 
> > org.apache.nifi.script.ScriptingComponentHelper.createResources(ScriptingComponentHelper.java:163)
> > at 
> > org.apache.nifi.script.ScriptingComponentHelper.createResources(ScriptingComponentHelper.java:141)
> > at 
> > org.apache.nifi.processors.script.InvokeScriptedProcessor.getSupportedPropertyDescriptors(InvokeScriptedProcessor.java:155)
> > at 
> > org.apache.nifi.processors.script.BaseScriptTest.setupInvokeScriptProcessor(BaseScriptTest.java:63)
> > at 
> > org.apache.nifi.processors.script.TestInvokeGroovy.setup(TestInvokeGroovy.java:51)
> > at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
> > Method)
> > at 
> > java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> > at 
> > java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > at java.base/java.lang.reflect.Method.invoke(Method.java:566)
> > at 
> > org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:688)
> > at 
> > org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
> > at 
> > org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
> > at 
> > org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
> > at 
> > org.junit.jupiter.engine.extension.TimeoutExtension.interceptLifecycleMethod(TimeoutExtension.java:126)
> > at 
> > org.junit.jupiter.engine.extension.TimeoutExtension.interceptBeforeEachMethod(TimeoutExtension.java:76)
> > at 
> > org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
> > at 
> > org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
> > at 
> > org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
> > at 
> > org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
> > at 
> > org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
> > at 
> > org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
> > at 
> > org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
> > at 
> > org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
> > at 
> > org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeMethodInExtensionContext(ClassBasedTestDescriptor.java:490)
> > at 
> > org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$synthesizeBeforeEachMethodAdapter$19(ClassBasedTestDescriptor.java:475)
> > at 
> > org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeBeforeEachMethods$2(TestMethodTestDescriptor.java:167)
> > at 
> > org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeBeforeMethodsOrCallbacksUntilExceptionOccurs$5(TestMethodTestDescriptor.java:195)
> > at 
> > org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> > at 
> > org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeBeforeMethodsOrCallbacksUntilExceptionOccurs(TestMethodTestDescriptor.java:195)
> > at 
> > org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeBeforeEachMethods(TestMethodTestDescriptor.java:164)
> > at 
> > org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:127)
> > at 
> > org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:65)
> > at 
> > org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
> > at 
> > org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> > at 
> > org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
> > at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
> > at 
> > org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
> > at 
> > org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> > at 
> > org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
> > at 
> > org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
> > at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
> > at 
> > org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
> > at 
> > org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
> > at 
> > org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> > at 
> > org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
> > at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
> > at 
> > org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
> > at 
> > org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> > at 
> > org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
> > at 
> > org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
> > at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
> > at 
> > org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
> > at 
> > org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
> > at 
> > org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> > at 
> > org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
> > at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
> > at 
> > org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
> > at 
> > org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> > at 
> > org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
> > at 
> > org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
> > at 
> > org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
> > at 
> > org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
> > at 
> > org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
> > at 
> > org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:108)
> > at 
> > org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
> > at 
> > org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
> > at 
> > org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
> > at 
> > org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
> > at 
> > org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:96)
> > at 
> > org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:75)
> > at 
> > com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:71)
> > at 
> > com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
> > at 
> > com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
> > at 
> > com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
> > at 
> > com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
> > at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
> > Caused by: java.lang.ClassNotFoundException:
> > org.jetbrains.kotlin.config.KotlinCompilerVersion
> > at 
> > java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
> > at 
> > java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
> > at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
> > ... 78 more
> >
> > On Wed, Mar 2, 2022 at 4:17 PM Mike Thomsen <[email protected]> wrote:
> > >
> > > Caused by: java.lang.NoClassDefFoundError:
> > > org/jetbrains/kotlin/config/KotlinCompilerVersion
> > >
> > > That's all I have right at the moment. But yeah, I think I saw in the
> > > bigger stacktraces mentions about the system classloader.
> > >
> > > On Wed, Mar 2, 2022 at 4:11 PM Matt Burgess <[email protected]> wrote:
> > > >
> > > > Mike,
> > > >
> > > > I haven't had a chance to repro the problem but when I've seen this
> > > > with scripting engines it's usually because they do some stuff under
> > > > the hood with the system classloader and not the thread's context
> > > > classloader...
> > > >
> > > > What classpath issue are you seeing?
> > > >
> > > > Regards,
> > > > Matt
> > > >
> > > > On Wed, Mar 2, 2022 at 2:35 PM Mike Thomsen <[email protected]> 
> > > > wrote:
> > > > >
> > > > > Here's the branch:
> > > > > https://github.com/MikeThomsen/nifi/commit/588da17a42f9ad34192be31bd5252cad518147fd
> > > > >
> > > > > Here's a gist that works just fine when you run it locally:
> > > > > https://gist.github.com/MikeThomsen/90d81c584bfd21d43cfe143963f716a9
> > > > >
> > > > > It appears to be something specific to how we handle classpaths. Any 
> > > > > thoughts?
> > > > >
> > > > > Thanks,
> > > > >
> > > > > Mike

Reply via email to