Manipulating additional attributes for a deployed application

You can manipulate attributes for a deployed application through the administrative console, the wsadmin tool, or by programming. Use this example to manipulate attributes that are not exposed during or after application installation through the AppDeploymentTask object.


Before you begin

This task assumes a basic familiarity with MBean programming and the ConfigService interfaces. For information on MBean programming, see MBean Java application programming interface (API) documentation. For information on ConfigService interfaces, see Java application programming interface (API) documentation..

Before you can manipulate additional attributes for your deployed application on WebSphere Application Server, first install your application.


About this task

Perform the following tasks for your deployed application to manipulate attributes that are not exposed through the AppDeploymentTask object. The attributes are saved in the deployment.xml file that is created in the configuration repository for each deployed application.



  1. Create a session.

  2. Connect to WebSphere Application Server.

  3. Locate the ApplicationDeployment object.

  4. Manipulate the attributes.

  5. Save your changes.

  6. Clean up the session.



After you successfully run the code, the attributes are updated in the deployment.xml file for the deployed application.



The following example shows how to manipulate the startingWeight, warClassLoaderPolicy, and classloader attributes based on the previous steps.

import java.util.Properties;



public class AppManagementSample1 {

  public static void main(String[] args) {
    String hostName = "localhost";
    String port = "8880";
    String appName = "ivtApp";

    ConfigService configService = null;

    // create a session.
    Session session = new Session();

    // establish connection to the server.
    try {
      Properties props = new Properties();
      props.setProperty(AdminClient.CONNECTOR_HOST, hostName);
      props.setProperty(AdminClient.CONNECTOR_PORT, port);
      AdminClient adminClient = 

      // create a config service proxy object.
      configService = new ConfigServiceProxy(adminClient);

      // Locate the application object.
      ObjectName rootID = configService.resolve(session,
      System.out.println ("rootID is: " + rootID);

      // Locate the ApplicationDeployment object from the root. 
      ObjectName appDeplPattern = ConfigServiceHelper.createObjectName
            (null, "ApplicationDeployment");
      ObjectName appDeplID = configService.queryConfigObjects(session, 
          rootID, appDeplPattern, null)[0];
      AttributeList list1 = configService.getAttributes(session, 
          rootID, new String[]{"deployedObject"}, false);
      ObjectName appDeplID = (ObjectName)
        ConfigServiceHelper.getAttributeValue(list1, "deployedObject");
      System.out.println ("appDeplID: " + appDeplID);
      // Locate the class loader.
      // Change the starting weight through the startingWeight attribute. The starting weight 
       // affects the order in which applications start.
      AttributeList attrList = new AttributeList();
      Integer newWeight = new Integer (10);
      attrList.add(new Attribute("startingWeight", newWeight));

      // Change the WAR class loader policy through the warClassLoaderPolicy attribute by 
       // specifying SINGLE or MULTIPLE.
      // SINGLE=one classloader for all WAR modules
      attrList.add(new Attribute("warClassLoaderPolicy", "SINGLE"));

      // Set the class loader mode to PARENT_FIRST or PARENT_LAST.
      AttributeList clList = (AttributeList) configService.getAttribute
        (session, appDeplID, "classloader");
      ConfigServiceHelper.setAttributeValue (clList, "mode",
      attrList.add (new Attribute ("classloader", clList));

      // Set the new values.
      configService.setAttributes(session,  appDeplID, attrList);

      // Save your changes., false);

    } catch (Exception ex) {
    } finally {
            // Clean up the session.
      try {
      catch (ConfigServiceException csEx)
      catch (ConnectorException cnEx)

Related concepts
Application management Related tasks
Installing an application through programming




WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.
IBM is a trademark of the IBM Corporation in the United States, other countries, or both.