Details
Details
Assignee
Michael Offner
Michael OffnerReporter
Sean Daniels
Sean DanielsPriority
Labels
New Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Affects versions
Created 29 June 2020 at 20:11
Updated 7 October 2021 at 14:59
I have some code that formats JSON into a pretty printed string.
var jsonengine = createObject("java","javax.script.ScriptEngineManager").init().getEngineByName("nashorn"); jsonengine.eval("function prettyPrintJSON (data) { return JSON.stringify(JSON.parse(data), null, '\t'); }"); jsonengine = JavaCast("javax.script.Invocable", jsonengine); return jsonengine.invokeFunction("prettyPrintJSON", [serializeJSON(rbjson)]);
This code works fine normally but when called from an asyc thread, it fails with an error in the thread.log. This only stopped working in some recent Lucee update, I believe it worked fine in 5.2. Stacktrace from thread.log:
variable [JSONENGINE] doesn't exist;variable [JSONENGINE] doesn't exist;lucee.runtime.exp.ExpressionException: variable [JSONENGINE] doesn't exist
at lucee.runtime.type.scope.UndefinedImpl.getCollection(UndefinedImpl.java:429)
at models.resources_cfc$cf$4v.udfCall(/models/Resources.cfc:37)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:217)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:680)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:568)
at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1898)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:785)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1710)
at interceptors.syncmanager_cfc$cf$4u.udfCall(/interceptors/SyncManager.cfc:49)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344)
at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:207)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:681)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:568)
at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1917)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:898)
at lucee.runtime.functions.dynamicEvaluation.Invoke.call(Invoke.java:49)
at coldbox.system.web.context.interceptorstate_cfc$cf.udfCall2(/coldbox/system/web/context/InterceptorState.cfc:446)
at coldbox.system.web.context.interceptorstate_cfc$cf.udfCall(/coldbox/system/web/context/InterceptorState.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344)
at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:207)
at lucee.runtime.type.scope.UndefinedImpl.callWithNamedValues(UndefinedImpl.java:792)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:864)
at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1729)
at coldbox.system.web.context.interceptorstate_cfc$cf.udfCall1(/coldbox/system/web/context/InterceptorState.cfc:314)
at coldbox.system.web.context.interceptorstate_cfc$cf.udfCall(/coldbox/system/web/context/InterceptorState.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344)
at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:207)
at lucee.runtime.ComponentScopeShadow.callWithNamedValues(ComponentScopeShadow.java:331)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:864)
at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1729)
at coldbox.system.web.context.interceptorstate_cfc$cf.threadCall(/coldbox/system/web/context/InterceptorState.cfc:175)
at lucee.runtime.thread.ChildThreadImpl.execute(ChildThreadImpl.java:204)
at lucee.runtime.thread.ChildThreadImpl.run(ChildThreadImpl.java:146)