UniTime / unitime

Comprehensive University Timetabling System
http://www.unitime.org
Apache License 2.0
274 stars 162 forks source link

Distribution Types: Create Max Days Constraints in unitime #110

Closed maysajabareen closed 2 years ago

maysajabareen commented 2 years ago

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

tomas-muller commented 2 years ago

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
maysajabareen commented 2 years ago

في أحد، ١٥ مايو، ٢٠٢٢ في ٦:١٦ م، كتب Tomáš Müller @.***

:

The error indicates that the language in which the script was written is not available. The Scripts https://help.unitime.org/scripts page is using JSR 223: Scripting for the Java Platform https://docs.oracle.com/javase/8/docs/technotes/guides/scripting/index.html to run the scripts. The Distribution Types: Create Max Days Constraints https://github.com/UniTime/unitime/blob/master/Documentation/Scripts/Create%20Max%20Days%20Constraints.xml 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. [image: Screenshot 2022-05-15 at 17 04 22] https://user-images.githubusercontent.com/10631634/168479751-195f4ed0-48d6-4975-9851-71377c8f5a0a.png

— Reply to this email directly, view it on GitHub https://github.com/UniTime/unitime/issues/110#issuecomment-1126962182, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWL4XBP7ETRL57G376PYQZLVKEILNANCNFSM5V7BFOWQ . You are receiving this because you authored the thread.Message ID: @.***>

But didn’t show any options available under the Engine dropdown(is null)

--

This message is from Palestine Ahliya University. The email and its attachment may be confidential and are intended solely for the use of the individual to whom it is addressed. If you have received a message in error please notify the sender immediately and erase all copies of the message and any attachments.  Any views expressed in any message are those of the individual sender and may not necessarily reflect the views of Palestine Ahliya University. 

tomas-muller commented 2 years ago

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.

tomas-muller commented 2 years ago

For more details please see How can I continue to use Javascript in Java 15 onwards and Using Nashorn with different Java versions.

maysajabareen commented 2 years ago

thank you very much it succeeded