WSADMIN Tutorial – Part2

In the previous part of this tutorial, we have learned what is WSADMIN, what it can do and different objects of wsadmin and the use of them. In this part, let us learn how to install, start/stop and update or deployment tasks of applications using WSADMIN on to clusters and single servers.

Deploying Applications

You can install the application in batch mode, using the install command, or you can install the application in interactive mode using the installinteractive command. Interactive mode prompts you through a series of tasks to provide information.All the options available to use are listed here in the IBM documentation.

note: words in bold are command or options and in italic are your inputs

To find out the options available to install the EAR file, run:


Installing EAR application:

Using Batch Mode:

If you are deploying on single servers….make sure that server is running before you execute the commands.

AdminApp.install(‘/home/joseph/applications/SampleApp.ear’, ‘[-server test_server1]’)

If you are deploying it in network deployment/ Clusters, you must connect to WSADMIN of deployment manager.

AdminApp.install(‘/home/joseph/applications/SampleApp.ear’, ‘[-cluster sample_cluster]’)

Using Interactive Mode:


now it will take you through a series of questions before finishing the deployment.

After the deployment is done, you need to perform two more steps

step1. Save the changes by issuing

step2. Synchronize the changes across all nodes by using

Sync1 = AdminControl.completeObjectName(‘type=NodeSync,node=myNodeName,*’)

and then

AdminControl.invoke(Sync1, ‘sync’)

step2 is required only for network deployment models.

Starting Applications

this involves two steps.
step1: getting the handler of the application, means .. locating where the application is running. To do this we use a variable and use querynames option on admincontrol object

appHandle= AdminControl.queryNamescell=SampleCell,node=virt_node1,type=ApplicationManager,process=test_server1,*’)
print appHandle

then you will get an output like the one below


step2: Now we execute the command to start the application

AdminControl.invoke(appHandle, ‘startApplication’, ‘Dynamic Cache Monitor’)

You can do both steps at once by using the below format

AdminControl.invoke(‘WebSphere:name=ApplicationManager,process=test_server1,node=virt_node1,type=ApplicationManager,mbeanIdentifier=ApplicationManager,cell=SampleCell, ‘startApplication‘, ‘[“Dynamic Cache Monitor“]’, ‘[java.lang.String]’)

Stopping Application

The steps are same as starting the application except ‘startApplication’ should be renamed to ‘stopApplication’

But, if you want to stop all applications running on a server… after executing step1 of above
Step2: you need to first get the list of applications

# get line separator
import java.lang.System as sys
lineSeparator = sys.getProperty(‘line.separator’)
apps_list = AdminControl.queryNames(‘cell=SampleCell,node=virt_node1,type=Application,process=test_server1,*’).split(lineSeparator)
print apps_list

Step3: now we need to create a loop to stop the applications one by one

for app in apps_list:
appName = AdminControl.getAttribute(app, ‘name’)
AdminControl.invoke(appHandle, ‘stopApplication’, appName)

Updating Application

We have different options to update applications, like, full update, module update, single file update etc…Similar to the install, we do have both batch mode and interactive mode for updating [update and updateinteractive]. All the options available to use are listed here in the IBM documentation.

  • updating entire application

    AdminApp.update(‘SampleApp’, ‘app’, ‘[-operation update -contents /home/joseph/applications/SampleAppv2.ear ]’)

  • Adding a new module to EJB

    AdminApp.update(‘SampleApp’, ‘modulefile’, ‘[-operation addupdate -contents /home/joseph/applications/Increment.jar -contenturi Increment.jar -nodeployejb
    -BindJndiForEJBNonMessageBinding [[“Increment Enterprise Java Bean” Increment Increment.jar,META-INF/ejb-jar.xml Inc]]]’)

  • Updating Single file

    AdminApp.update(‘SampleApp’, ‘file’, ‘[-operation update -contents /home/joseph/applications/my.xml -contenturi SampleApp/my.xml]’)

TIP: Use the taskInfo command of the AdminApp object to obtain information about the data that is needed for your application.

for example, you want to know what options you need to supply for mapping modules to servers…use the following taskinfo command

AdminApp taskInfo <ear file> MapModulesToServers


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s