Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 895030

Summary: Adding a new XADatasource with invalid configuration to EAP6 using CLI ends with NPE
Product: [JBoss] JBoss Operations Network Reporter: Filip Brychta <fbrychta>
Component: Plugin -- JBoss EAP 6Assignee: Thomas Segismont <tsegismo>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: medium Docs Contact:
Priority: low    
Version: JON 3.1.2CC: hrupp, myarboro
Target Milestone: GA   
Target Release: JON 3.2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-02 20:43:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
CLI script none

Description Filip Brychta 2013-01-14 10:39:05 UTC
Created attachment 678162 [details]
CLI script

Description of problem:
$Summary 
I accidentally passed a configuration for a non-XA datasource to XADatasource and child creation process (adding a new XADatasource to EAP6 in standalone mode) failed with NPE.
 
Version-Release number of selected component (if applicable):
Version: 3.1.2.CR1
Build Number: f6e41ba:33f6cb2

How reproducible:
Always

Steps to Reproduce:
1. have a clean JON installation running, EAP6 is running in standalone mode and is imported to the JON inventory
2. run attached CLI script using CLI client (i.e. ./rhq-cli.sh -p rhqadmin -u rhqadmin -s 10.34.131.214 -f test.js)

  
Actual results:
Script output:
Remote server version is: 3.1.2.CR1 (f6e41ba:33f6cb2)
Login successful
This is the parent resource of XADatasource:
Resource:
	                 id: 13345
	               name: datasources
	            version: 
	currentAvailability: UP
	       resourceType: Datasources (Standalone)
This is the resource type which will be created:
ResourceType:
	      id: 10093
	    name: XADataSource (Standalone)
	category: Service
	  plugin: JBossAS7
Configuration used for this resource type:
Configuration [0] - null
  jndi-name = java:jboss/datasources/testDS
  driver-name = h2
  connection-url = jdbc:h2:mem:test;DB_CLOSE_DELAY=-1
one row
CreateResourceHistory:
	      configuration: Configuration[id=22560]
	        createdDate: Mon Jan 14 11:33:30 CET 2013
	createdResourceName: testDS
	        createdTime: 1358159610279
	           duration: 128
	       errorMessage: java.lang.NullPointerException
	at org.rhq.mod...
	                 id: 10191
	   installedPackage: 
	   lastModifiedDate: Mon Jan 14 11:33:30 CET 2013
	   lastModifiedTime: 1358159610407
	     newResourceKey: 
	     parentResource: Resource[id=13345, uuid=5939d50a-9842-4024-88b6-bd57f4ce16c5, type={JBossAS7}Datasources (Standalone), key=subsystem=datasources, name=datasources]
	       resourceType: XADataSource (Standalone)
	             status: Failure
	        subjectName: rhqadmin
Error message: java.lang.NullPointerException
	at org.rhq.modules.plugins.jbossas7.DatasourceComponent.createResource(DatasourceComponent.java:98)
	at sun.reflect.GeneratedMethodAccessor275.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocationThread.call(ResourceContainer.java:634)
	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)



Expected results:
Validation error, no NPE

Additional info:
Although the XADatasource creation failed (status: Failure), the XADatasource was created and is autodiscovered by JON (use platform's manual autodiscovery operation). 
Second invocation of attached scripts ends with:
Error message: JBAS014803: Duplicate resource [
    ("subsystem" => "datasources"),
    ("xa-data-source" => "testDS")
], rolled-back=true

Comment 1 Heiko W. Rupp 2013-08-12 08:57:02 UTC
Thomas, can you please look into this when you have time?

Comment 2 Heiko W. Rupp 2013-08-13 13:50:12 UTC
See also Bug 996582

Comment 3 Thomas Segismont 2013-08-21 17:13:11 UTC
This bug is not related to BZ996582

The NPE was because we expected the '*2' property to be present, although it was not set in the configuration object.

Fixed in master

commit fc26b931aa11429a32094641a88d7fe3147955d9
Author: Thomas Segismont <tsegismo>
Date:   Wed Aug 21 19:10:41 2013 +0200

Added a validation of the supplied configuration object
Change creation logic as '*2' is not a required attribute

Comment 4 Simeon Pinder 2013-12-13 16:13:52 UTC
Moving this to ON_QA, as discussed in triage call (myarboro,loleary,spinder). This is already in the GA tag but somehow we didn't set this to ON_QA.