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:
Triage for 1.3.1
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.
QA Verified; NPE no longer occurs when invoking operations. Tested this against Tomcat on RHEL5.
Mass-closure of verified bugs against JON.