groovy.lang.MissingMethodException:没有方法签名:java.lang.String.call() 适用于参数类型:() 值:[]
groovy.lang.MissingMethodException: No signature of method: java.lang.String.call() is applicable for argument types: () values: []
我正在尝试使用 groovy 代码从 RESTAPI
访问数据,但出现如下错误:
groovy.lang.MissingMethodException: No signature of method: java.lang.String.call() is applicable for argument types: () values: []
Possible solutions: wait(), chars(), any(), wait(long), take(int), tap(groovy.lang.Closure)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:70)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:182)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeClosure(ScriptBytecodeAdapter.java:586)
错误主要出现在代码行的以下部分:
String requestString = getRequestStringPrefix() + sb.toString()
readHistory(authToken,ricMap,outFile)
writeInstFile(outFile)
我是 groovy 编码方面的新手,并不完全了解问题的原因以及如何在代码中解决此问题。
使用此 getRequestStringPrefix()
调用具有该名称的方法或作为快捷方式调用基础对象上的方法 call()
,则它看起来像 getRequestStringPrefix.call()
.
我不确定你的意图是什么,但是行:
String requestString = getRequestStringPrefix() + sb.toString()
应该看起来像
String requestString = getRequestStringPrefix + sb.toString()
因为变量 getRequestStringPrefix
(var 的奇怪名称)被进一步定义为字符串:
String getRequestStringPrefix = """{
"ExtractionRequest": {..."""
我正在尝试使用 groovy 代码从 RESTAPI
访问数据,但出现如下错误:
groovy.lang.MissingMethodException: No signature of method: java.lang.String.call() is applicable for argument types: () values: []
Possible solutions: wait(), chars(), any(), wait(long), take(int), tap(groovy.lang.Closure)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:70)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:182)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeClosure(ScriptBytecodeAdapter.java:586)
错误主要出现在代码行的以下部分:
String requestString = getRequestStringPrefix() + sb.toString()
readHistory(authToken,ricMap,outFile)
writeInstFile(outFile)
我是 groovy 编码方面的新手,并不完全了解问题的原因以及如何在代码中解决此问题。
使用此 getRequestStringPrefix()
调用具有该名称的方法或作为快捷方式调用基础对象上的方法 call()
,则它看起来像 getRequestStringPrefix.call()
.
我不确定你的意图是什么,但是行:
String requestString = getRequestStringPrefix() + sb.toString()
应该看起来像
String requestString = getRequestStringPrefix + sb.toString()
因为变量 getRequestStringPrefix
(var 的奇怪名称)被进一步定义为字符串:
String getRequestStringPrefix = """{
"ExtractionRequest": {..."""