NiFi 1.23.2中无法解析groovy.yaml.YamlSlurper类问题咨询
NiFi 1.23.2中Groovy脚本无法解析groovy.yaml.YamlSlurper的问题
问题背景
使用NiFi 1.23.2版本,在ExecuteScript处理器(内置Groovy 3.0.17)和ExecuteGroovyScript处理器(内置Groovy 3.0.18)中,均出现无法解析groovy.yaml.YamlSlurper类的问题。
测试脚本
脚本1(极简验证)
import groovy.yaml.YamlSlurper return
脚本2(直接引用类)
def YamlSlurper = groovy.yaml.YamlSlurper def y = new YamlSlurper()
验证错误信息
点击处理器的“Verify Properties”按钮后,触发编译错误,核心报错为unable to resolve class groovy.yaml.YamlSlurper,完整堆栈信息如下:
Perform Validation Component is invalid: 'GroovyScript' is invalid because org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script53405bee.groovy: 1: unable to resolve class groovy.yaml.YamlSlurper @ line 1, column 392. che.nifi.logging.ComponentLog;import gro ^ org.codehaus.groovy.syntax.SyntaxException: unable to resolve class groovy.yaml.YamlSlurper @ line 1, column 392. at org.codehaus.groovy.ast.ClassCodeVisitorSupport.addError(ClassCodeVisitorSupport.java:262) at org.codehaus.groovy.control.ResolveVisitor.visitClass(ResolveVisitor.java:1424) at org.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:262) at org.codehaus.groovy.control.CompilationUnit.lambda$new$16(CompilationUnit.java:739) at org.codehaus.groovy.control.CompilationUnit$ISourceUnitOperation.doPhaseOperation(CompilationUnit.java:902) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:628) at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:389) at groovy.lang.GroovyClassLoader.lambda$parseClass$3(GroovyClassLoader.java:332) at org.codehaus.groovy.runtime.memoize.StampedCommonCache.compute(StampedCommonCache.java:163) at org.codehaus.groovy.runtime.memoize.StampedCommonCache.getAndPut(StampedCommonCache.java:154) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:330) at groovy.lang.GroovyShell.parseClass(GroovyShell.java:526) at groovy.lang.GroovyShell.parse(GroovyShell.java:538) at groovy.lang.GroovyShell.parse(GroovyShell.java:570) at org.apache.nifi.processors.groovyx.ExecuteGroovyScript.getGroovyScript(ExecuteGroovyScript.java:338) at org.apache.nifi.processors.groovyx.ExecuteGroovyScript.customValidate(ExecuteGroovyScript.java:222) at org.apache.nifi.components.AbstractConfigurableComponent.validate(AbstractConfigurableComponent.java:130) at org.apache.nifi.controller.AbstractComponentNode.computeValidationErrors(AbstractComponentNode.java:780) at org.apache.nifi.controller.StandardProcessorNode.computeValidationErrors(StandardProcessorNode.java:1141) at org.apache.nifi.controller.AbstractComponentNode.performValidation(AbstractComponentNode.java:735) at org.apache.nifi.controller.AbstractComponentNode.verifyConfig(AbstractComponentNode.java:392) at org.apache.nifi.controller.StandardProcessorNode.verifyConfiguration(StandardProcessorNode.java:1071) at org.apache.nifi.web.dao.impl.StandardProcessorDAO.verifyProcessorConfiguration(StandardProcessorDAO.java:488) at org.apache.nifi.web.dao.impl.StandardProcessorDAO$$FastClassBySpringCGLIB$$779e089b.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:793) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:708) at org.apache.nifi.web.dao.impl.StandardProcessorDAO$$EnhancerBySpringCGLIB$$4feca1d.verifyProcessorConfiguration(<generated>) at org.apache.nifi.web.StandardNiFiServiceFacade.performProcessorConfigVerification(StandardNiFiServiceFacade.java:843) at org.apache.nifi.web.StandardNiFiServiceFacade$$FastClassBySpringCGLIB$$358780e0.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:793) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:708) at org.apache.nifi.web.StandardNiFiServiceFacade$$EnhancerBySpringCGLIB$$245ce634.performProcessorConfigVerification(<generated>) at org.apache.nifi.web.api.ProcessorResource.lambda$performAsyncConfigVerification$27(ProcessorResource.java:1097) at org.apache.nifi.web.api.concurrent.AsyncRequestManager$2.run(AsyncRequestManager.java:117) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.base/java.util.concurrent.FutureTask.run(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source) 1 error
疑问
- 该问题属于NiFi或Groovy的Bug吗?
- 是否存在配置环节的遗漏?
- 有没有可行的解决办法?
内容的提问来源于stack exchange,提问作者GBC
相关产品推荐
相关产品推荐

