Bug 736792 - CLI retrieveBackingContent gives a file not found exception on the agent
Summary: CLI retrieveBackingContent gives a file not found exception on the agent
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: CLI
Version: 4.2
Hardware: All
OS: All
high
medium vote
Target Milestone: ---
: ---
Assignee: RHQ Project Maintainer
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks: jon30-bugs 743764
TreeView+ depends on / blocked
 
Reported: 2011-09-08 17:39 UTC by dsteigne
Modified: 2018-11-14 10:50 UTC (History)
3 users (show)

Fixed In Version: 4.2
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 769939 (view as bug list)
Environment:
Last Closed: 2012-02-07 19:19:01 UTC


Attachments (Terms of Use)
Proposed patch against b1771757b971949dfe69cccfaa062c957bfc03ff (1.69 KB, patch)
2011-09-29 19:23 UTC, Larry O'Leary
loleary: review+
Details | Diff
example script (2.34 KB, text/javascript)
2011-10-06 18:04 UTC, Mike Foley
no flags Details

Description dsteigne 2011-09-08 17:39:34 UTC
Description of problem:
If you try to use retrieveBackingContent per the example in the CLI Guide, http://docs.redhat.com/docs/en-US/JBoss_Operations_Network/2.4/html/CLI_Guide/Scripted_Group_Deployments_using_the_CLI_API.html you receive the following error:

On CLI:
sun.org.mozilla.javascript.internal.WrappedException: Wrapped javax.ejb.EJBExcep
tion: [Warning] java.lang.RuntimeException: Unable to retrieve package bits for
resource: 12331 and package: 23261 before timeout. (<Unknown source>#91) in <Unk
nown source> at line number 91

At the agent:

Caused by: java.io.FileNotFoundException: filename.war (No such file or directory)


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

Comment 2 Larry O'Leary 2011-09-29 19:21:39 UTC
Steps to reproduce:
# Install JBoss EAP 5.1.0 server
# Start JBoss EAP 5.1.0 server using production configuration
# Import JBoss EAP 5.1.0 server into inventory
# Execute CLI
   pushd "${workDir}"/rhq-remoting-cli-*/bin && ./rhq-cli.sh && popd
# Execute CLI commands
   login rhqadmin rhqadmin localhost 7080
   var rc = new ResourceCriteria();
   rc.addFilterResourceTypeName('Web Application (WAR)');
   rc.addFilterName('admin-console.war');
   var adminConsole = ResourceManager.findResourcesByCriteria(rc);
   var war = ProxyFactory.getResource(adminConsole.get(0).id);
   war.retrieveBackingContent("/tmp/admin-console.war.bak");

Actual Results:
Execution of war.retrieveBackingContent fails with a timeout message:
Wrapped javax.ejb.EJBException: [Warning] java.lang.RuntimeException: Unable to retrieve package bits for resource: 10017 and package: 10092 before timeout. (<Unknown source>#1)
war.retrieveBackingContent("/tmp/admin-console.war.bak"); 
^

If debug logging is enabled on the agent, a root cause exception and stack is sent back to the CLI:
java.lang.RuntimeException: Failed to retrieve package bits for PackageDetails[Key=PackageDetailsKey[Name=admin-console.war, Version=1.3.4.SP1 (1.3.4.SP1) Arch=noarch Type=file]]
	at org.rhq.plugins.jbossas5.StandaloneManagedDeploymentComponent.retrievePackageBits(StandaloneManagedDeploymentComponent.java:127)
	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$ComponentInvocationThread.call(ResourceContainer.java:525)
	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:636)
Caused by: java.io.FileNotFoundException: admin-console.war (No such file or directory)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:137)
	at org.rhq.plugins.jbossas5.StandaloneManagedDeploymentComponent.retrievePackageBits(StandaloneManagedDeploymentComponent.java:125)
	... 10 more


Expected Result:
The method should succeed and a file should be written to /tmp named admin-console.war.bak that contains the contents of <JBOSS_SERVER_HOME>/deploy/admin-console.war/


Additional Notes:
The issue is due to ResourcePackageDetails not containing a complete path to the resource but instead just a file name. Additionally, StandaloneManagedDeploymentComponent is using the key name for file name instead of file name.

Comment 3 Larry O'Leary 2011-09-29 19:23:41 UTC
Created attachment 525625 [details]
Proposed patch against b1771757b971949dfe69cccfaa062c957bfc03ff

Comment 4 John Sanda 2011-10-03 14:44:41 UTC
I haven't tested this, but I did review the code and see the problem. The patch looks good to me.

Comment 5 Larry O'Leary 2011-10-05 22:28:38 UTC
Committed to master as d20a12576a1cc01320c2ce77a665511d20bebc4d

Comment 6 Mike Foley 2011-10-06 18:04:27 UTC
logged new BZ https://bugzilla.redhat.com/show_bug.cgi?id=744004 while verifying this.  attaching the CLI script i used to verify.

Comment 7 Mike Foley 2011-10-06 18:04:49 UTC
Created attachment 526765 [details]
example script

Comment 8 Mike Foley 2012-02-07 19:19:01 UTC
changing status of VERIFIED BZs for JON 2.4.2 and JON 3.0 to CLOSED/CURRENTRELEASE


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