0 Replies Latest reply on Oct 9, 2013 4:15 PM by jd7033

    Bundle Deployment Issue (bundled file seems to be removed by RHQ agent before being copied to final dest)

    jd7033

      Hello All,

      We have a new install of RHQ 4.8 That works pretty much as expected aside from this issue.

       

      I have created an Ant bundle to deploy a war file to Tomcat 7, which works exactly as expected when tested/installed the standalone bundle deployment tool, however the same script does not work when uploaded and deployed through the RHQ web interface for bundles. In looking at the log, the installations fail with the error below: The error outlined in red suggests that the war file is already moved into by the time the script tries to install it. One interesting note is that if I upload a war file manually into a directory and point to it in the XML file, the installation works, so I am beginning to suspect the agent is moving the WAR file too soon -- before it gets deployed to Tomcat.

       

      To summarize, it works as expected from the command line with the bundle deployment tool, but when I attempt it to deploy via RHQ, it fails and the logs seem to imply the war file is gone, not matter what I select as a deployment directory. Is my XML file (see below) incorrect for deploying WAR files to a Tomcat server?

       

      *** begin error ***

      2013-10-09 13:02:44,774 INFO  [InventoryManager.availability-1] (rhq.core.pc.inventory.AvailabilityExecutor)- Scan Ended   : Wed Oct 09 13:02:44 PDT 2013 : Scan [startTime=1381348964766, endTime=1381348964774, runtime=8, isFull=false, isForced=false, numResources=44, numGetAvailabilityCalls=7, numScheduledRandomly=0, numPushedByInterval=6, numAvailabilityChanges=0, numDeferToParent=0]

      2013-10-09 13:03:01,616 ERROR [ResourceContainer.invoker.nonDaemon-13] (org.rhq.plugins.ant.AntBundlePluginComponent)- Failed to deploy bundle [class org.rhq.core.pluginapi.bundle.BundleDeployRequest: deployment=[BundleResourceDeployment: bdd=[BundleDeployment[id=10691, name=Deployment [2] of Version [1.1.7] to [nixlab]]], resource=[Resource[id=12061, uuid=384079be-6ca7-40f5-9bbd-66f701785908, type={Platforms}Linux, key=drnixlab1-1.secnet.raleys.com, name=drnixlab1-1.<SNIPPED>, parent=<null>, version=Linux 2.6.32-358.11.1.el6.x86_64]]], full-deploy-directory=[/var/tmp/tomcat], clean=[false], revert=[false]]

      java.lang.Exception: Failed to execute the bundle Ant script

              at org.rhq.plugins.ant.AntBundlePluginComponent.deployBundle(AntBundlePluginComponent.java:159)

              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: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:1146)

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

              at java.lang.Thread.run(Thread.java:679)

      Caused by: java.lang.RuntimeException: Failed to execute bundle deploy file [/opt/rhq-agent/data/tmp/bundle-versions/10591/ant-bundle-recipe189925053957469289.xml]. Cause: /opt/rhq-agent/data/tmp/bundle-versions/10591/ant-bundle-recipe189925053957469289.xml:47: java.io.FileNotFoundException: /var/tmp/tomcatsample.war (No such file or directory)

              at org.rhq.bundle.ant.AntLauncher.executeBundleDeployFile(AntLauncher.java:118)

              at org.rhq.plugins.ant.AntBundlePluginComponent.executeDeploymentPhase(AntBundlePluginComponent.java:306)

              at org.rhq.plugins.ant.AntBundlePluginComponent.deployBundle(AntBundlePluginComponent.java:139)

              ... 10 more

      Caused by: /opt/rhq-agent/data/tmp/bundle-versions/10591/ant-bundle-recipe189925053957469289.xml:47: java.io.FileNotFoundException: /var/tmp/tomcatsample.war (No such file or directory)

       

      *** end error ***

       

      *** begin deploy.xml ***

      <project name="qa" default="main" xmlns:rhq="antlib:org.rhq.bundle">

      <rhq:bundle name="War_Bundle" version="1.1.7" description="War file installer for Tomcat">

      <rhq:deployment-unit name="Prod" preinstallTarget="deploy-webapp" postinstallTarget="postinstall">

              <rhq:archive name="sample.war" exploded="false"/>

        <rhq:ignore>

        <rhq:fileset>

        <include name="webapps/*"/>

        <include name="/var/tmp/tomcatdeploy/*"/>

        </rhq:fileset>

        </rhq:ignore>

        </rhq:deployment-unit>

      </rhq:bundle>

      <target name="main" />

        <target name="deploy-webapp">

        <path id="catalina-ant-classpath">

           <fileset dir="/opt/tomcat7/lib">

          <include name="catalina-ant.jar"/>

          <include name="tomcat-coyote.jar"/>

          <include name="tomcat-util.jar"/>

        </fileset>

           <fileset dir="/opt/tomcat7/bin">

              <include name="tomcat-juli.jar"/>

           </fileset>

        </path>

       

        <taskdef name="catalina-deploy" classname="org.apache.catalina.ant.DeployTask" classpathref="catalina-ant-classpath"/>

        <taskdef name="catalina-list" classname="org.apache.catalina.ant.ListTask" classpathref="catalina-ant-classpath"/>

        <taskdef name="catalina-reload" classname="org.apache.catalina.ant.ReloadTask" classpathref="catalina-ant-classpath"/>

        <taskdef name="catalina-findleaks" classname="org.apache.catalina.ant.FindLeaksTask" classpathref="catalina-ant-classpath"/>

        <taskdef name="catalina-resources" classname="org.apache.catalina.ant.ResourcesTask" classpathref="catalina-ant-classpath"/>

        <taskdef name="catalina-start" classname="org.apache.catalina.ant.StartTask" classpathref="catalina-ant-classpath"/>

        <taskdef name="catalina-stop" classname="org.apache.catalina.ant.StopTask" classpathref="catalina-ant-classpath"/>

        <taskdef name="catalina-undeploy" classname="org.apache.catalina.ant.UndeployTask" classpathref="catalina-ant-classpath"/>

       

       

        <echo>Removing Old Version</echo>

        <catalina-undeploy url="http://localhost:8080/manager/text/"

        username="admin"

        password="admin"

        path="/sample"/>

       

        <echo>Installing New Version</echo>

        <catalina-deploy url="http://localhost:8080/manager/text/"

        username="admin"

        password="admin"

        path="/sample"

        war="${rhq.deploy.dir}sample.war"/>

       

       

        <property name="InstallTargetExecuted" value="true"/>

        </target>

        <target name="postinstall">

        <echo>Done deploying Test Bundle v1.0 to ${rhq.deploy.dir}.</echo>

        <property name="postinstallTargetExecuted" value="true"/>

        </target>

      </project>

      *** end deply.xml ***