UniTime/unitime

Distribution Types: Create Max Days Constraints in unitime

maysajabareen opened this issue · 5 comments

Failed: Cannot invoke "javax.script.ScriptEngine.put(String, Object)" because "engine" is null

Execution failed: Cannot invoke "javax.script.ScriptEngine.put(String, Object)" because "engine" is null
java.lang.NullPointerException: Cannot invoke "javax.script.ScriptEngine.put(String, Object)" because "engine" is null
at org.unitime.timetable.server.script.ScriptExecution.execute(ScriptExecution.java:178)
at org.unitime.timetable.util.queue.QueueItem.executeItem(QueueItem.java:104)
at org.unitime.timetable.server.script.ScriptExecution.executeItem(ScriptExecution.java:337)
at org.unitime.timetable.util.queue.LocalQueueProcessor$RunningItem.run(LocalQueueProcessor.java:249)

Capture

The error indicates that the language in which the script was written is not available. The Scripts page is using JSR 223: Scripting for the Java Platform to run the scripts. The Distribution Types: Create Max Days Constraints script is written using ECMAScript which is typically the default script engine that is available in most JVMs.

What Java are you using? If you click on Add New button, which options are available under the Engine dropdown? Ideally, it should list at least ECMAScript in which case the script should run without any issues.
Screenshot 2022-05-15 at 17 04 22

If you are using Java 15 or later, the ECMAScript engine may not be available by default. In this case, you need to install a JSR233 compatible JavaScript engine manually. The easiest is to use the standalone version of Nashorn (which used to be included in Java till version 14). To do so, download the following JARs and put them in Tomcat/lib folder. You will need to restart the Tomcat afterward.

thank you very much it succeeded