Bug 537480

Summary: NPE when invoking operations on resource returned from ProxyFactory
Product: [Other] RHQ Project Reporter: Keith Babo <kbabo>
Component: CLIAssignee: RHQ Project Maintainer <rhq-maint>
Status: CLOSED CURRENTRELEASE QA Contact: Corey Welton <cwelton>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.3CC: cwelton, spinder
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 2.4 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
JON 2.3 with EWS
Last Closed: 2010-08-12 16:45:59 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 557793    

Description Keith Babo 2009-11-13 19:33:59 UTC
Description of problem:
Operations on a Tomcat host resource returned from ProxyFactory throw an NPE after completion.  The operation is actually successful, so I'm guessing there is some post-processing in the CLI that's failing after the operation has completed.


Version-Release number of selected component (if applicable):
JON 2.3 with EWS plugin talking to a tomcmat EWS instance

Steps to Reproduce:
rhqadmin@localhost:7080$ findResources("My Tomcat")
one row
Resource:
                  id: 10631
                name: My Tomcat
             version: 6.0.18.0
        resourceType: Tomcat Server

rhqadmin@localhost:7080$ var tomcat = ProxyFactory.getResource(10631)

rhqadmin@localhost:7080$ tomcat.start()
Invoking operation start
sun.org.mozilla.javascript.internal.WrappedException: Wrapped java.lang.NullPointerException
tomcat.start() 
  
Actual results:
NPE

Expected results:
No NPE :-)

Additional info:

Comment 1 Charles Crouch 2009-11-16 17:27:18 UTC
Triage for 1.3.1

Comment 2 Simeon Pinder 2010-01-11 21:23:54 UTC
CP Branch: svn rev 5273

linux-config: git hash 7a3d23c9e853edb5bc2b8bc6ac937bde14d3c483

The difficulty here is not in fixing the RHQ code, but in detecting where in the RHQ code that there is an underlying problem because it is the scripting engine that is the running environment.  The NPE was being thrown in script code that RhinoScriptEngine was running. The initial exception is not very descriptive so the key is to write some code that wraps the offending script code as shown in the following logic and more details(line numbers and true cause should then be apparent.) and then execute.

#######################
function g() {  
  try {
     var tomcat = ProxyFactory.getResource(10005);

     tomcat.start();
     tomcat.shutdown();
     print("DONE");

  } catch (e) {
     e.rhinoException.printStackTrace();
  }
}

g();
########################

Tracking down the offending exception when RhinoScriptEngine code is not easily available took a few hours.

Comment 3 Corey Welton 2010-01-23 00:04:17 UTC
QA Verified; NPE no longer occurs when invoking operations.  Tested this against Tomcat on RHEL5.

Comment 4 Corey Welton 2010-08-12 16:45:59 UTC
Mass-closure of verified bugs against JON.