Bug 862011 - CLI method updateBackingContent fails with NPE when invoked on EAP6 server group deployment
CLI method updateBackingContent fails with NPE when invoked on EAP6 server gr...
Status: CLOSED CURRENTRELEASE
Product: JBoss Operations Network
Classification: JBoss
Component: CLI (Show other bugs)
JON 3.1.0
All All
high Severity urgent
: ---
: JON 3.1.2
Assigned To: Jay Shaughnessy
Mike Foley
:
Depends On: 851145
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-01 11:19 EDT by Larry O'Leary
Modified: 2013-09-11 07:04 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-09-11 07:04:24 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
content.png (79.61 KB, image/png)
2012-11-28 08:27 EST, Filip Brychta
no flags Details
test script (1.38 KB, application/javascript)
2012-11-28 08:28 EST, Filip Brychta
no flags Details

  None (edit)
Description Larry O'Leary 2012-10-01 11:19:50 EDT
Unable to update EAP 6 server group deployment using updateBackingContent. When invoked, a NPE is returned:


    rhqadmin@localhost:7080$ serverGroupDeploymentProxy.updateBackingContent("my/war/file.war");
    Wrapped java.lang.NullPointerException (<Unknown source>#1)
    serverGroupDeploymentProxy.updateBackingContent("my/war/file.war"); 


Version-Release number of selected component (if applicable):
JON 3.1.0

How reproducible:
Always


Steps to Reproduce:
1.  Install ON system
2.  Install EAP 6 domain with one managed host
3.  Start EAP 6 domain and managed host
4.  Start ON system
5.  Add EAP domain to inventory
6.  Deploy a test WAR to EAP:

        # git clone git://github.com/jboss-jdf/jboss-as-quickstart.git
        cd jboss-as-quickstart/helloworld
        mvn package
        # Deploy target/jboss-as-helloworld.war to EAP 6
        ${JBOSS_HOME}/bin/jboss-cli.sh --connect "deploy target/jboss-as-helloworld.war --all-server-groups"

7.  Execute the following CLI commands -- if not using jboss-as-helloworld.war, change the variables as needed:

        ./rhq-cli.sh -u rhqadmin -p rhqadmin -s localhost -t 7080

        // The EAP6 server group the test WAR is deployed to
        var serverGroupName="main-server-group";
        // The actual file name of the test WAR
        var warFileName="jboss-as-helloworld.war";
        // The complete path for where a local copy of <warFileName> can be found
        var warFilePath="/home/loleary/workspace/jboss/jboss-as-quickstart/helloworld/target";

        // fetch the server-group
        var groupTypeCriteria = new ResourceTypeCriteria();
        groupTypeCriteria.addFilterName("ServerGroup");
        var groupTypeList = ResourceTypeManager.findResourceTypesByCriteria(groupTypeCriteria);
        var groupType = groupTypeList.get(0);
        var groupCriteria = new ResourceCriteria();
        groupCriteria.addFilterResourceTypeId(groupType.getId());
        groupCriteria.addFilterResourceKey("server-group=" + serverGroupName);
        var serverGroup = ResourceManager.findResourcesByCriteria(groupCriteria).get(0);


  
Actual results:
Wrapped java.lang.NullPointerException (<Unknown source>#1)
serverGroupDeploymentProxy.updateBackingContent(warFilePath + "/" + warFileName);

Expected results:
No error and content gets updated
Comment 1 Larry O'Leary 2012-10-01 11:49:00 EDT
This issue appears to be a direct result of Bug 856186 - NullPointerException when trying to deploy war on EAP 6 in domain mode using CLI and createPackageBackedResource method
Comment 2 Larry O'Leary 2012-10-01 16:00:32 EDT
Scratch what I said in comment 1. This appears to be very similar but the fix from the upstream bug doesn't fix this issue. Apparently there is another executing path in where we are throwing the NPE.
Comment 3 Jay Shaughnessy 2012-11-15 10:43:18 EST
The errant codepath was already removed in JON 3.1.1.  So, this should be fixed already for 3.1.2.

Moving to MODIFIED to be tested in next 3.1.2 build, which will also contain the related fix for Bug 856186, which was recently cherry-picked.
Comment 4 Simeon Pinder 2012-11-21 16:56:11 EST
Moving to ON_QA as available for test with build : https://brewweb.devel.redhat.com//buildinfo?buildID=244662.
Comment 5 Filip Brychta 2012-11-28 08:26:08 EST
Still getting following exception on 3.1.2.ER2:
Caused by: java.lang.NullPointerException
	at org.rhq.bindings.client.ResourceClientProxy$ClientProxyMethodHandler.updateBackingContent(ResourceClientProxy.java:545)
	at org.rhq.bindings.client.ResourceClientProxy$ClientProxyMethodHandler.updateBackingContent(ResourceClientProxy.java:519)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)


Attached test script for this scenario. See following output.

Complete output:
[jon@mylocal bin]$ ./rhq-cli.sh -u rhqadmin -p rhqadmin -f test2.js
Remote server version is: 3.1.2.ER2 (504cef5:b78316e)
Login successful
ResourceType:
	      id: 10122
	    name: ServerGroup
	category: Service
	  plugin: JBossAS7
Resource:
	                 id: 10758
	               name: main-server-group
	            version: 
	currentAvailability: UP
	       resourceType: ServerGroup
ResourceClientProxy_$$_javassist_1:
	                   availability: ?
	                 backingContent: 
	                       children: 
	                   contentTypes: {file=File}
	                    createdDate: Wed Nov 28 13:18:27 CET 2012
	                    description: 
	                        handler: 
	                             id: 11403
	                   measurements: [Status, Availability]
	                   modifiedDate: Wed Nov 28 13:18:27 CET 2012
	                           name: helloworld.war
	                     operations: [restart, enable, disable]
	            pluginConfiguration: 
	  pluginConfigurationDefinition: ConfigurationDefinition[id=10497, name=Deployment]
	          resourceConfiguration: 
	resourceConfigurationDefinition: ConfigurationDefinition[id=10498, name=Deployment]
	                   resourceType: Deployment
	                         status: ?
	                        version: 
Exception in thread "main" org.rhq.enterprise.client.script.CLIScriptException: javax.script.ScriptException: sun.org.mozilla.javascript.WrappedException: Wrapped java.lang.NullPointerException (<Unknown source>#37) in <Unknown source> at line number 37
	at org.rhq.enterprise.client.commands.ScriptCommand.executeScriptFile(ScriptCommand.java:298)
	at org.rhq.enterprise.client.commands.ScriptCommand.execute(ScriptCommand.java:108)
	at org.rhq.enterprise.client.ClientMain$StartupConfiguration.process(ClientMain.java:141)
	at org.rhq.enterprise.client.ClientMain.main(ClientMain.java:161)
Caused by: javax.script.ScriptException: sun.org.mozilla.javascript.WrappedException: Wrapped java.lang.NullPointerException (<Unknown source>#37) in <Unknown source> at line number 37
	at com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:183)
	at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:249)
	at org.rhq.enterprise.client.commands.ScriptCommand.executeScriptFile(ScriptCommand.java:287)
	... 3 more
Caused by: sun.org.mozilla.javascript.WrappedException: Wrapped java.lang.NullPointerException (<Unknown source>#37)
	at sun.org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1786)
	at sun.org.mozilla.javascript.MemberBox.invoke(MemberBox.java:183)
	at sun.org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:247)
	at sun.org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
	at sun.org.mozilla.javascript.gen._Unknown_source__197._c_script_0(<Unknown source>:37)
	at sun.org.mozilla.javascript.gen._Unknown_source__197.call(<Unknown source>)
	at sun.org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:426)
	at com.sun.script.javascript.RhinoScriptEngine$1.superDoTopCall(RhinoScriptEngine.java:112)
	at com.sun.script.javascript.RhinoScriptEngine$1.doTopCall(RhinoScriptEngine.java:105)
	at sun.org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3178)
	at sun.org.mozilla.javascript.gen._Unknown_source__197.call(<Unknown source>)
	at sun.org.mozilla.javascript.gen._Unknown_source__197.exec(<Unknown source>)
	at sun.org.mozilla.javascript.Context.evaluateReader(Context.java:1142)
	at com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:173)
	... 5 more
Caused by: java.lang.NullPointerException
	at org.rhq.bindings.client.ResourceClientProxy$ClientProxyMethodHandler.updateBackingContent(ResourceClientProxy.java:545)
	at org.rhq.bindings.client.ResourceClientProxy$ClientProxyMethodHandler.updateBackingContent(ResourceClientProxy.java:519)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.rhq.bindings.client.ResourceClientProxy$ClientProxyMethodHandler.invoke(ResourceClientProxy.java:602)
	at org.rhq.bindings.client.ResourceClientProxy_$$_javassist_1.updateBackingContent(ResourceClientProxy_$$_javassist_1.java)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at sun.org.mozilla.javascript.MemberBox.invoke(MemberBox.java:161)
	... 17 more


See attached content.png. There is no content for helloworld.war resource in main-server-group. Can this be the cause? Helloworld is however correctly deployed and accessible via browser.
Comment 6 Filip Brychta 2012-11-28 08:27:42 EST
Created attachment 653525 [details]
content.png
Comment 7 Filip Brychta 2012-11-28 08:28:45 EST
Created attachment 653526 [details]
test script
Comment 8 Heiko W. Rupp 2012-12-07 08:52:37 EST
Works for me with the current version of the release branch of today (compiled by me, not the "official" bits

$ bin/rhq-cli.sh -u rhqadmin -p rhqadmin -f test2.js 
Listening for transport dt_socket at address: 9787
Remote server version is: 4.4.0.JON312CI (d3bb1c9)
Login successful
ResourceType:
	      id: 10165
	    name: ServerGroup
	category: Service
	  plugin: JBossAS7
Resource:
	                 id: 10030
	               name: main-server-group
	            version: 
	currentAvailability: UP
	       resourceType: ServerGroup
ResourceClientProxy_$$_javassist_1:
	                   availability: ?
	                 backingContent: InstalledPackage[resource=test-simple.war,packageVersion=null]
	                       children: 
	                   contentTypes: {file=File}
	                    createdDate: Mon Nov 26 12:08:09 CET 2012
	                    description: 
	                        handler: 
	                             id: 10342
	                   measurements: [Status, Availability]
	                   modifiedDate: Mon Nov 26 12:08:09 CET 2012
	                           name: test-simple.war
	                     operations: [restart, enable, disable]
	            pluginConfiguration: 
	  pluginConfigurationDefinition: ConfigurationDefinition[id=10558, name=Deployment]
	          resourceConfiguration: 
	resourceConfigurationDefinition: ConfigurationDefinition[id=10559, name=Deployment]
	                   resourceType: Deployment
	                         status: ?
	                        version: 
snert:/im/rhq-jon31x/modules/enterprise/remoting/cli/target/rhq-remoting-cli-4.4.0.JON312CI hrupp $
Comment 9 Charles Crouch 2012-12-10 19:14:49 EST
Well the explanation seems fairly simple...

Comment5 (fails)
	                 id: 10758
	               name: main-server-group
	                  ...
             backingContent: 


Comment8 (works)
                         id: 10030
	               name: main-server-group
                         ...	          
	     backingContent: InstalledPackage[resource=test-simple.war,packageVersion=null]


If there is no backingcontent we blow up with an NPE trying to calculate the version field
Comment 10 Filip Brychta 2012-12-11 08:03:22 EST
As stated at the last line of comment 5, application Helloworld was correctly deployed and was accessible via browser, however there was no content for that resource (see attached content.png). The cause of this could be somehow related to bug 855925 which was fixed and verified on 3.1.2.ER3. 

I retested this issue on 3.1.2.ER4 and updateBackingContent is working correctly (which means that content wasn't empty after app helloworld was successfully deployed on main-server-group) -> moving to verified.

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