JBoss EAP 7 CLI batch command failure with "deploy --force" for replace deployment

Solution Verified - Updated

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 7.0.0

Issue

  • Error while deploying using JBoss CLI

  • Using deploy --force command on JBoss EAP 7 CLI batch mode fails and returns an error message.

  • This used to work with JBoss EAP 6.4.7 however since I have upgraded to EAP 7 I get the following error:

  • Command:

#jboss-cli.sh --connect --controller=127.0.0.1:9999 --user=admin --password=xxx --file="deploy.cli"
The batch failed with the following error (you are remaining in the batch editing mode to have a chance to correct the error): Request is missing the address part.
  • deploy.cli:
batch
deploy --force ./jboss-ejb-in-ear.ear
run-batch

Resolution

...
<validate-operation-requests>false</validate-operation-requests>
...

For more information , refer link https://access.redhat.com/solutions/427163

Root Cause

There is no adding "address" key in buildDeploymentReplace() of org.jboss.as.cli.handlers.DeployHandler like below.
Even though on CLI batch mode it validates existence of "address" key in request with Util.validateRequest(), when 'run-batch' command execute in org.jboss.as.cli.handlers.batch.BatchRunHandler.doHandle()

  • First deploy: deployment add request by calling org.jboss.as.cli.handlers.DeployHandler.buildDeploymentAdd()
{
    "operation" => "add",
    "address" => {"deployment" => "jboss-ejb-in-ear.ear"},
    "content" => [{"bytes" => bytes {
    ...
    }}]
}
  • After second deploy: deployment replace request by calling org.jboss.as.cli.handlers.DeployHandler.buildDeploymentReplace()
{
    "operation" => "full-replace-deployment",
    "name" => "jboss-ejb-in-ear.ear",
    "enabled" => true,
    "content" => [{"bytes" => bytes {
    ...
    }}]
}
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.