Maximo Automation Script : Fixing Java Script error post updating to Java 1.8 / Oracle Nashorn scripting engine
Error :
BMXAA7837E – An error occurred that prevented the <ScriptName>
script for the <LaunchPointNamelaunch point from running."importPackage\" is not defined in <eval> at line number X.
If you have upgraded your maximo version to latest release (
7.6.0.6+) and have existing automation scripts written in Java Script ( using
older script engines e.g. Mozilla Rhino) , then you will receive
this error
when upgrade version of maximo has Java 1.8 based scripting engines ( Oracle Nashorn) for this style import statements :
imporClass(Packages.psdi.util.logging.MXLoggerFactory)
Reason for this error is that, Nashorn script engine (got
updated via Java 1.8) does not support the import of whole Java packages as it was in
Mozilla Rhino engine.
Refer this URL for details - https://stackoverflow.com/questions/22502630/switching-from-rhino-to-nashorn
To fix this error, workaround is to add below line of code beginning
/prior to import statements
load("nashorn:mozilla_compat.js");