This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours
Bug 736792 - CLI retrieveBackingContent gives a file not found exception on the agent
CLI retrieveBackingContent gives a file not found exception on the agent
Status: CLOSED CURRENTRELEASE
Product: RHQ Project
Classification: Other
Component: CLI (Show other bugs)
4.2
All All
high Severity medium (vote)
: ---
: ---
Assigned To: RHQ Project Maintainer
Mike Foley
:
Depends On:
Blocks: jon30-bugs 743764
  Show dependency treegraph
 
Reported: 2011-09-08 13:39 EDT by dsteigne
Modified: 2012-02-07 14:19 EST (History)
3 users (show)

See Also:
Fixed In Version: 4.2
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 769939 (view as bug list)
Environment:
Last Closed: 2012-02-07 14:19:01 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


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

  None (edit)
Description dsteigne 2011-09-08 13:39:34 EDT
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 15:21:39 EDT
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 15:23:41 EDT
Created attachment 525625 [details]
Proposed patch against b1771757b971949dfe69cccfaa062c957bfc03ff
Comment 4 John Sanda 2011-10-03 10:44:41 EDT
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 18:28:38 EDT
Committed to master as d20a12576a1cc01320c2ce77a665511d20bebc4d
Comment 6 Mike Foley 2011-10-06 14:04:27 EDT
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 14:04:49 EDT
Created attachment 526765 [details]
example script
Comment 8 Mike Foley 2012-02-07 14:19:01 EST
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.