Bug 856819 - [as7, CLI] NullPointerException when trying to deploy war on EAP 6 in domain mode using CLI and createPackageBackedResource method
[as7, CLI] NullPointerException when trying to deploy war on EAP 6 in domain ...
Status: CLOSED CURRENTRELEASE
Product: RHQ Project
Classification: Other
Component: CLI (Show other bugs)
4.4
All All
urgent Severity high (vote)
: ---
: RHQ 4.5.0
Assigned To: Jay Shaughnessy
Mike Foley
:
Depends On:
Blocks: 856186
  Show dependency treegraph
 
Reported: 2012-09-12 16:43 EDT by Larry O'Leary
Modified: 2013-09-01 06:00 EDT (History)
3 users (show)

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


Attachments (Terms of Use)

  None (edit)
Description Larry O'Leary 2012-09-12 16:43:25 EDT
+++ This bug was initially created as a clone of product Bug #856186 +++

Description of problem:
I tried to deploy war file on EAP 6 in domain mode using the following:

*******
var deploymentResourceType = ResourceTypeManager.getResourceTypeByNameAndPlugin('DomainDeployment', 'JBossAS7');

var criteria = new ResourceCriteria();
criteria.addFilterResourceKey("/home/JBoss/jboss-eap-6.0/domain");
var domain = ResourceManager.findResourcesByCriteria(criteria).iterator().next();

var domainProxy = ProxyFactory.getResource(domain.getId());

var deployConfig = new Configuration();
deployConfig.put(new PropertySimple("runtimeName", domainProxy.name));

var file = new java.io.File("/home/HelloWorld.war");
var inputStream = new java.io.FileInputStream(file);
var fileLength = file.length();
var fileBytes = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, fileLength);
for (numRead=0, offset=0; ((numRead >= 0) && (offset < fileBytes.length)); offset += numRead ) {numRead = inputStream.read(fileBytes, offset, fileBytes.length - offset);}
500238

var histo = ResourceFactoryManager.createPackageBackedResource(domain.getId(),deploymentResourceType.id, domainProxy.name, null, "kitchensink", "1.0", null, deployConfig, fileBytes, 500000)
*******
There is no error reported back and I can see the following line in server.log file:

[Host Controller] 11:56:47,996 INFO  [org.jboss.as.repository] (HttpManagementService-threads - 2) JBAS014900: Content added at location /home/JBoss/jboss-eap-6.0/domain/data/content/7a/8d0d406226c5c578bca957af3669d397af7d00/content

but agent.log file contains the following exception:

2012-09-11 11:56:48,162 DEBUG [ResourceFactory.executor-1] (rhq.core.pc.inventory.ResourceContainer$ResourceComponentInvocationHandler)- Call to [org.rhq.modules.plugins.jbossas7.HostControllerComponent.createResource()] with args [[CreateResourceReport: ResourceType=[{JBossAS7}DomainDeployment], ResourceKey=[null]]] failed.
java.util.concurrent.ExecutionException: java.lang.NullPointerException
	at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:232)
	at java.util.concurrent.FutureTask.get(FutureTask.java:91)
	at org.rhq.core.pc.inventory.ResourceContainer$ResourceComponentInvocationHandler.invokeInNewThreadWithLock(ResourceContainer.java:554)
	at org.rhq.core.pc.inventory.ResourceContainer$ResourceComponentInvocationHandler.invoke(ResourceContainer.java:542)
	at $Proxy72.createResource(Unknown Source)
	at org.rhq.core.pc.inventory.CreateResourceRunner.call(CreateResourceRunner.java:114)
	at org.rhq.core.pc.inventory.CreateResourceRunner.run(CreateResourceRunner.java:95)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NullPointerException
	at org.rhq.modules.plugins.jbossas7.BaseComponent.deployContent(BaseComponent.java:409)
	at org.rhq.modules.plugins.jbossas7.HostControllerComponent.createResource(HostControllerComponent.java:115)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocationThread.call(ResourceContainer.java:634)
	... 5 more

and "child history" will show unsuccessful attempt to create a child with the following:

2012-09-11 11:56:48,163 INFO  [ResourceFactory.executor-1] (rhq.core.pc.inventory.CreateResourceRunner)- Sending create response to server: CreateResourceResponse[RequestId=10121, Status=Failure]

and HelloWorld.war will not be visible.


Version-Release number of selected component (if applicable):
RHQ 4.4.0

How reproducible:
Every time.

Steps to Reproduce:
1.
2.
3.
  
Actual results:
NPE is thrown and war file is not visible.

Expected results:
No exception is thrown and deployment is properly done.

Additional info:
Comment 1 Jay Shaughnessy 2012-09-14 15:02:31 EDT
master commmit 123a951be3bd28161cdf7ccf3d45e59124d86489

The AS7 deployment code was relying on PackageVersion.filename being set. But this is not a reliable field, it only reflects the filename of the file uploaded to provide the content.  It can't be used because:
 - It is not set unless the file is tryly uploaded (like in the GUI via
   PackageVersionFileUploadServlet)
 - It is not set via the CLI, or potentially other mechanisms, which supply 
   only the binary content
 - It is not necessarily a valid reflection of the content (i.e. not unique, etc)

The packageName is really the only thing we can use here. It is guaranteed,
is unique, and should reflect the content. It is what is used for similar needs in the previous plugins.
Comment 2 Heiko W. Rupp 2013-09-01 06:00:07 EDT
Bulk closing of items that are on_qa and in old RHQ releases, which are out for a long time and where the issue has not been re-opened since.

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