在我的Java8 Sping Boot 应用程序中,它依赖于groovy-json
库版本3.0.19来执行groovy脚本,当我的应用程序war文件部署在Tomcat中时,它会失败,但不会部署在Docker或本地开发设置中。在执行像new groovy.json.JsonSlurper().parseText('{}')
这样的脚本时,我会看到下面的异常:
'javax.script.ScriptException:java.lang.RuntimeException:无法加载FastStringService'
上面的运行时异常来自groovy-json包中的这部分代码:https://github.com/apache/groovy/blob/GROOVY_3_0_19/subprojects/groovy-json/src/main/java/org/apache/groovy/json/internal/FastStringUtils.java#L35-L59
我已经查找了冲突的依赖项,在我的应用程序中只有这个版本的groovy-json库。有问题的特定类实际上存在于我的工件中。对这个错误有什么想法吗?
更新内容:
Stacktrace:
"org.flowable.common.engine.impl.scripting.FlowableScriptEvaluationException: groovy script evaluation failed: 'javax.script.ScriptException: org.flowable.common.engine.impl.scripting.FlowableScriptEvaluationException: groovy script evaluation failed: 'javax.script.ScriptException: java.lang.RuntimeException: Unable to load FastStringService''",
" at org.flowable.common.engine.impl.scripting.ScriptingEngines.evaluate(ScriptingEngines.java:132)",
"Caused by: javax.script.ScriptException: javax.script.ScriptException: java.lang.RuntimeException: Unable to load FastStringService",
" at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:158)",
" at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233)",
" at org.flowable.common.engine.impl.scripting.ScriptingEngines.evaluate(ScriptingEngines.java:111)",
" ... 152 more",
"Caused by: javax.script.ScriptException: java.lang.RuntimeException: Unable to load FastStringService",
" at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:320)",
" at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:155)",
" ... 154 more",
"Caused by: java.lang.RuntimeException: Unable to load FastStringService",
" at org.apache.groovy.json.internal.FastStringUtils.getService(FastStringUtils.java:56)",
" at org.apache.groovy.json.internal.FastStringUtils.toCharArray(FastStringUtils.java:66)",
" at org.apache.groovy.json.internal.BaseJsonParser.parse(BaseJsonParser.java:113)",
" at groovy.json.JsonSlurper.parseText(JsonSlurper.java:204)",
" at groovy.json.JsonSlurper$parseText.call(Unknown Source)",
" at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)",
" at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)",
" at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:139)",
" at Script449.run(Script449.groovy:2)",
" at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:317)",
" ... 155 more"```
Tomcat version: 9.0.71
字符串
1条答案
按热度按时间whitzsjs1#
有时候,编译器发现当java和groovy的源代码在多个源目录中时很难解决依赖关系,所以你可以通过在
build.gradle
中添加以下内容来告诉gradle/the compiler在哪里找到要编译的源代码:字符串