Created attachment 786160 [details] script with repro steps Description of problem: Creating 'DataSource (Standalone)' resource via CLI fails with NPE. All required parameters (connection-url,jndi-name,driver-name) are set. NPE is thrown when 'enabled' parameter is unset. See attached script for detailed info. Version-Release number of selected component (if applicable): Version: 4.9.0-SNAPSHOT Build Number: c9283bd How reproducible: Always Steps to Reproduce: 1. JBossAS7 Standalone Server is imported 2. run attached test.js script (./rhq-cli.sh -s <serverIP> -p rhqadmin -u rhqadmin -f test.js) Actual results: Child creation fails with following exception (visible on GUI - eap->datasources->Inventory->Child History): java.lang.NullPointerException at org.rhq.modules.plugins.jbossas7.DatasourceComponent.createResource(DatasourceComponent.java:139) 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.core.pc.inventory.ResourceContainer$ComponentInvocation.call(ResourceContainer.java:654) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:679)
This is because enabled is a required attribute and the resource configuration you have built does not have it. I'm looking for a way to retrieve a default resource configuration from the server.
(In reply to Thomas Segismont from comment #1) > This is because enabled is a required attribute and the resource > configuration you have built does not have it. Sorry I understood the problem in reverse order. So, you're right, 'enabled' attribute is not a required attribute and does not need to be sent. Fixed that in master. commit b1c756593a32f47ae2bafaa0466fecddd5bf721d Author: Thomas Segismont <tsegismo> Date: Wed Aug 21 18:42:35 2013 +0200 By the way, maybe you already know, but if you need to create a config object with default values for required attributes you can do this: var confDef = ConfigurationManager.getResourceConfigurationDefinitionForResourceType(resType.id) var conf = org.rhq.core.domain.configuration.ConfigurationUtility.createDefaultConfiguration(confDef);
Verified on Version: 4.9.0-SNAPSHOT Build Number: 434b099
Bulk closing of RHQ 4.9 verified items