]
Chao Wang reassigned WFCORE-1569:
---------------------------------
Assignee: Chao Wang (was: Ken Wills)
NPE when executing a full-replace-deployment operation followed by an
add operation for the same deployment
-----------------------------------------------------------------------------------------------------------
Key: WFCORE-1569
URL:
https://issues.jboss.org/browse/WFCORE-1569
Project: WildFly Core
Issue Type: Bug
Components: Domain Management
Reporter: James Perkins
Assignee: Chao Wang
Attachments: issue-reproducer.zip
Executing the {{full-replace-deployment}} operation on a domain deployment works
correctly if it's a single operation (even in a composite operation). In a composite
operation where an {{add}} operation is executed to add the deployment to a
server-group(s) after the {{full-replace-deployment}} an NPE is thrown because the
previous resource is {{null}} since it did not exist.
{code:java|title=org.jboss.as.server.deployment.DeploymentFullReplaceHandler}
// WFCORE-495 remove and call context.addResource() as below to add new resource with
updated PERSISTENT value
final ModelNode deploymentModel =
context.removeResource(PathAddress.pathAddress(deploymentPath)).getModel();
{code}
The {{context.removeResource()}} returns {{null}} since the deployment was not deployed
on the server in the server-group.
From debugging it looks like the full composite operation is passed to each server in a
server group. For obvious reasons if the {{add}} operation is done before the
{{full-replace-deployment}} operation the composite operation is successful.
The easy workaround is just to ignore missing deployments in the
{{org.jboss.as.server.deployment.DeploymentFullReplaceHandler}} OSH and log a debug or
trace message indicating it was skipped because the deployment did not previously exist on
the server. However this may need to be done at the HC operation routing level.