Instantiate List variables in a script task

Hello,
I have a script task (javascript) with the following code:

var cars = ["Renault","Porsche"];
print(typeof cars)
execution.setVariable("cars",cars);

When I execute it I get the following error:

No default constructor found on class com.oracle.truffle.polyglot.PolyglotMap: java.lang.NoSuchMethodException: com.oracle.truffle.polyglot.PolyglotMap

If I go to Cockpit I see that the type of voters variable is com.oracle.truffle.polyglot.PolyglotMap

I need an iterable collection instead.
Thanks!

Got the same issue when using Camunda v7.20 Springboot version with Graalvm 23.0.1. Looks like there is a compatibility issue.

Got similar issue with Nashorn as well:
Found temporary solution:

Root cause was trying to using JSON.parse to get a array value

Solution:
Use $(“xxx”).prop(“xx”) instead of JSON.parse

1 Like