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
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.
Created attachment 525625 [details] Proposed patch against b1771757b971949dfe69cccfaa062c957bfc03ff
I haven't tested this, but I did review the code and see the problem. The patch looks good to me.
Committed to master as d20a12576a1cc01320c2ce77a665511d20bebc4d
logged new BZ https://bugzilla.redhat.com/show_bug.cgi?id=744004 while verifying this. attaching the CLI script i used to verify.
Created attachment 526765 [details] example script
changing status of VERIFIED BZs for JON 2.4.2 and JON 3.0 to CLOSED/CURRENTRELEASE