JON CLI ProxyFactory.getResource occasionally returns incomplete resource object and method or field access will fail with TypeError: Cannot read property or find function

Solution Unverified - Updated -

Issue

  • rhq-remoting-cli issue
  • the following exception occurs:

    Exception in thread "main" org.rhq.enterprise.client.script.CLIScriptException: javax.script.ScriptException: sun.org.mozilla.javascript.EcmaError: TypeError: Cannot read property "displayValue" from undefined
            at org.rhq.enterprise.client.commands.ScriptCommand.executeScriptFile(ScriptCommand.java:298)
            ...
    Caused by: javax.script.ScriptException: sun.org.mozilla.javascript.EcmaError: TypeError: Cannot read property "displayValue" from undefined
            at com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:224)
            at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:249)
            ...
    Caused by: sun.org.mozilla.javascript.EcmaError: TypeError: Cannot read property "displayValue" from undefined
            at sun.org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3654)
            at sun.org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3632)
    
  • CLI script occasionally fails when invoking proxy method:

    Exception in thread "main" org.rhq.enterprise.client.script.CLIScriptException: javax.script.ScriptException: sun.org.mozilla.javascript.EcmaError: TypeError: Cannot find function getMessagesAdded in object [10316] queue-07 (JMS Queue::JBossAS7). (<Unknown source>#16) in <Unknown source> at line number 16
        at org.rhq.enterprise.client.commands.ScriptCommand.executeScriptFile(ScriptCommand.java:298)
        ...
    Caused by: javax.script.ScriptException: sun.org.mozilla.javascript.EcmaError: TypeError: Cannot find function getMessagesAdded in object [10316] queue-07 (JMS Queue::JBossAS7). (<Unknown source>#16) in <Unknown source> at line number 16
        at com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:179)
        at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:249)
        ...
    Caused by: sun.org.mozilla.javascript.EcmaError: TypeError: Cannot find function getMessagesAdded in object [10316] queue-07 (JMS Queue::JBossAS7). (<Unknown source>#16)
    

Environment

  • Red Hat JBoss Operations Network (ON) 3.1
  • JBoss ON commnad-line interface (CLI) script
  • Referencing a field or calling a method of a resource proxy object:

    • Field:

      ProxyFactory.getResource(resource.getId()).messagesAdded
      
    • Method:

      ProxyFactory.getResource(resource.getId()).getMessagesAdded()
      

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