Execution JBoss CLI script fails when executing using JBoss ON with the message: "Handover failed: Handover[action='execute-script', handoverParams=[], failOnError=true]"

Solution Unverified - Updated -

Issue

  • I`m running jboss cli script from a bundle and deploying them using JBoss Operations Network
  • When I execute Datasource.cli using deploy.xml in JBoss ON, the deployment fails with an error:
2015-06-04 16:37:27,900 ERROR [ResourceContainer.invoker.nonDaemon-1] (org.rhq.plugins.ant.AntBundlePluginComponent)- Failed to deploy bundle [class org.rhq.core.pluginapi.bundle.BundleDeployRequest:
deployment=[BundleResourceDeployment: bdd=[BundleDeployment[id=10114, name=Deployment [8] of Version [1.4] to [Datasource]]], resource=[Resource[id=14811, uuid=46dac48-cfb1-20d4-b80a-5cf294650226, ty
pe={Platforms}Linux, key=rel-test-my-server, name=rel-test-my-server, parent=<null>, version=Linux 2.6.32-431.el6.x86_64]]], target=[file:/usr/share/jbossas/standalone/deployments/datasource
/], clean=[false], revert=[false]]
java.lang.Exception: Failed to execute the bundle Ant script
        at org.rhq.plugins.ant.AntBundlePluginComponent.deployBundle(AntBundlePluginComponent.java:168)
        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:606)
        at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocation.call(ResourceContainer.java:759)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: Failed to execute bundle deploy file [/var/lib/jboss-on/agent/data/tmp/bundle-versions/10122/ant-bundle-recipe4996216253680013618.xml]. Cause: /var/lib/jboss-on/
agent/data/tmp/bundle-versions/10122/ant-bundle-recipe4996216253680013618.xml:5: Failed to deploy bundle [DatasourceCLI] version [1.4]: java.lang.Exception: Handover failed: Handover[action='execute-s
cript', handoverParams=[], failOnError=true]
        at org.rhq.bundle.ant.AntLauncher.executeBundleDeployFile(AntLauncher.java:154)
        at org.rhq.plugins.ant.AntBundlePluginComponent.executeDeploymentPhase(AntBundlePluginComponent.java:324)
        at org.rhq.plugins.ant.AntBundlePluginComponent.deployBundle(AntBundlePluginComponent.java:148)
        ... 9 more
Caused by: /var/lib/jboss-on/agent/data/tmp/bundle-versions/10122/ant-bundle-recipe4996216253680013618.xml:5: Failed to deploy bundle [DatasourceCLI] version [1.4]: java.lang.Exception: Handover failed: Handover[action='execute-script', handoverParams=[], failOnError=true]
        at org.rhq.bundle.ant.type.DeploymentUnitType.install(DeploymentUnitType.java:300)
        at org.rhq.bundle.ant.type.DeploymentUnitType.upgrade(DeploymentUnitType.java:532)
        at org.rhq.bundle.ant.task.BundleTask.execute(BundleTask.java:168)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        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:606)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:390)
        at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:179)
        at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:80)
        at org.rhq.bundle.ant.AntLauncher.executeBundleDeployFile(AntLauncher.java:150)
        ... 11 more
Caused by: java.lang.Exception: Handover failed: Handover[action='execute-script', handoverParams=[], failOnError=true]
        at org.rhq.bundle.ant.type.DeploymentUnitType.install(DeploymentUnitType.java:274)
        ... 24 more

Environment

  • Red Hat JBoss Operations Network (JON) 3.3.2
  • Executing JBoss CLI script using JBoss Operations Network and bundles
  • datasource.cli:

    batch
    # create datasource
    /subsystem=datasources/data-source="java:jboss/datasources/MySqlDS2":add(jndi-name="java:jboss/datasources/MySqlDS2",driver-name="mysql-connector-java-5.1.35-bin.jarcom.mysql.jdbc.Driver_5_1",connection-    url="jdbc:mysql://localhost:3306/test",user-name="root")
    # Execute
    run-batch
    
  • deploy.xml

    <?xml version="1.0"?>
    <project name="datasourceCLI" default="main"
                                  xmlns:rhq="antlib:org.rhq.bundle">
    
        <rhq:bundle name="datasourceCLI" version="1.0" description="Execute EAP handover script">
            <rhq:deployment-unit name="datasourceCLI" preinstallTarget="preinstall" postinstallTarget="postinstall" manageRootDir="false">
            <rhq:file name="datasource.cli" replace="true">
                <rhq:handover action="execute-script" failonerror="true"/>
            </rhq:file>
            </rhq:deployment-unit>
    </rhq:bundle>
    
    <target name="main" />
    
    <target name="preinstall">
        <echo>Deploying LoggingCLI...</echo>
        <property name="preinstallTargetExecuted" value="true"/>
    </target>
    
    <target name="postinstall">
        <echo>Done deploying LoggingCLI</echo>
        <property name="postinstallTargetExecuted" value="true"/>
    </target>
    </project>
    

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.