Bug 537480 - NPE when invoking operations on resource returned from ProxyFactory
Summary: NPE when invoking operations on resource returned from ProxyFactory
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: CLI
Version: 1.3
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: RHQ Project Maintainer
QA Contact: Corey Welton
URL:
Whiteboard:
Depends On:
Blocks: JON231
TreeView+ depends on / blocked
 
Reported: 2009-11-13 19:33 UTC by Keith Babo
Modified: 2010-08-12 16:45 UTC (History)
2 users (show)

Fixed In Version: 2.4
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
JON 2.3 with EWS
Last Closed: 2010-08-12 16:45:59 UTC
Embargoed:


Attachments (Terms of Use)

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.


Note You need to log in before you can comment on or make changes to this bug.