Receive "javax.script.ScriptException:org.mozilla.javascript.EcmaError: ReferenceError: "ResourceCriteria" is not defined." when running a JBoss ON CLI script as an Alert Notification

Solution Verified - Updated -

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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content