arquillian-container-wls icon indicating copy to clipboard operation
arquillian-container-wls copied to clipboard

Deploy on a specific Server.

Open massimogai opened this issue 10 years ago • 4 comments

Some days ago I wrote a changes to deploy an archive on a specified server because the current implementation deploys on all server managed by the AdminServer. See the code below for WebLogicJMXClient. Can be useful?

private void doDeploy(String deploymentName, File deploymentArchive) throws DeploymentException { try { String serverName = configuration.getTarget(); String[] targets = new String[]{serverName}; ObjectName domainRuntime = (ObjectName) connection.getAttribute(domainRuntimeService, "DomainRuntime"); ObjectName deploymentManager = (ObjectName) connection.getAttribute(domainRuntime, "DeploymentManager");

        ObjectName deploymentProgressObject = (ObjectName) connection.invoke(
                deploymentManager, "deploy",
                new Object[]{deploymentName, deploymentArchive.getAbsolutePath(), targets, null, new Properties()},
                new String[]{String.class.getName(), String.class.getName(), String[].class.getName(), String.class.getName(), java.util.Properties.class.getName()}
        );

        processDeploymentProgress(deploymentName, deploymentManager, deploymentProgressObject);
    } catch (DeploymentException e) {
        throw e;
    } catch (Exception e) {
        throw new DeploymentException(e.getMessage(), e);
    }
}

massimogai avatar Jan 19 '15 16:01 massimogai

By using the Container Configuration option 'target' you should be able to target the deployment to any server.

The name of the target for the deployment. This can be the name of the Admin Server i.e.
"AdminServer", the name of an individual Managed Server or the name of a Cluster (not
yet supported).

Unless this somehow got lost in the implementation?

aslakknutsen avatar Jan 19 '15 16:01 aslakknutsen

Il 19/01/2015 17:25, Aslak Knutsen ha scritto:

By using the Container Configuration option 'target' you should be able to target the deployment to server.

|The name of the target for the deployment. This can be the name of the Admin Server i.e. "AdminServer", the name of an individual Managed Server or the name of a Cluster (not yet supported). |

— Reply to this email directly or view it on GitHub https://github.com/arquillian/arquillian-container-wls/issues/17#issuecomment-70520777.

I'm using the Target property but the archive is installed on all managed servers. In the Mbean call,if you do not specify the target server for the deploy it will be installed at all. Indeed the Mbean documentation say: https://docs.oracle.com/middleware/1213/wls/WLMBR/core/index.html the same for WLS 12.1.2

massimogai avatar Jan 19 '15 16:01 massimogai

Aah, ic. Missed the use of configuration.getTarget in your sample code there.

So right.. the actual implementation of target got lost in implementation.. :)

Would you mind sending this as a pullrequest?

aslakknutsen avatar Jan 19 '15 16:01 aslakknutsen

Done. Thanks. Il 19/01/2015 17:37, Aslak Knutsen ha scritto:

Aah, ic. Missed the use of configuration.getTarget in your sample code there.

So right.. the actual implementation of target got lost in implementation.. :)

Would you mind sending this as a pullrequest?

— Reply to this email directly or view it on GitHub https://github.com/arquillian/arquillian-container-wls/issues/17#issuecomment-70522816.

massimogai avatar Jan 19 '15 16:01 massimogai