Receive "javax.script.ScriptException:org.mozilla.javascript.EcmaError: ReferenceError: "ResourceCriteria" is not defined." when running a JBoss ON CLI script as an Alert Notification
Issue
- I created an Alert and set a Notification to run a CLI Script, this script works if I run it directly with rhq-cli but when it's triggered by the Alert it fails with:
06:54:59,311 DEBUG [org.rhq.enterprise.server.alert.AlertManagerBean] (Thread-840) SenderResult{state=FAILURE, summary=Ran script simplelist.js in version rhqadmin:1.0 from repo Sample as user rhqadmin., successMessages=[], failureMessages=[javax.script.ScriptException:org.mozilla.javascript.EcmaError: ReferenceError: "ResourceCriteria" is not defined. (<Unknown source>#5) in <Unknown source> at line number 5 in script simplelist.js (rhqadmin:1.0) in repo Sample at line number 5]}
Environment
- Red Hat JBoss Operations Network (ON) 3.2.2
- ON Command Line Interface (CLI) 3.2.2
- CLI Script:
var e = exporter
e.setTarget( 'csv', '/jon-server-3.2.0.GA/logs/Scriptlist.log' )
var criteria = new ResourceCriteria();
criteria.addFilterResourceTypeName('Script Server');
var scriptservlist = ResourceManager.findResourcesByCriteria(criteria);
e.write(scriptservlist)
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
