Install/deploy application to weblogic admin server using WLST (script/example)

By | October 24, 2018
  • Given a application war file (*.war).
  • We would like to install/deploy it to weblogic server using WLST (WebLogic Scripting Tool).
  • We will execute deployment script from wlst console (oracle_common/common/bin/

1. Steps required to deploy application to weblogic server:

  1. Connect to admin server using admin server credentials.
  2. Start edit operation to deploy application.
  3. Deploy application to weblogic admin server
  4. Save and activate session.
  5. Disconnect from admin server.

2. WLST Script to install application to weblogic server:

def wlDeploy(username, password, adminURL, appName, appPath):
        #connect to admin server
        connect(username, password, adminURL)

        #start edit operation

        #start deploying application to admin server
        progress = deploy(appName,appPath,upload='true')

        #disconnect from Admin server
    except Exception, ex:
        print ex.toString()

#wlDeploy("weblogic","weblogic1","t3://","myAppName", "/app/restService.war")
wlDeploy("<Admin User Name>","<Password>","<AdminUrl","<App Name>", "<Path of war file>")

3. Output: deploy/install application to weblogic server

Connecting to t3://myserver:7001 with userid weblogic ...
Successfully connected to Admin Server "AdminServer" that belongs to domain "cluster".

Warning: An insecure protocol was used to connect to the server. 
To ensure on-the-wire security, the SSL port or Admin port should be used instead.

Location changed to edit tree. 	 
This is a writable tree with DomainMBean as the root. 	 
To make changes you will need to start an edit session via startEdit(). 
For more help, use help('edit').

Starting an edit session ...
Started edit session, be sure to save and activate your changes once you are done.
Deploying application from /home/apps/myAppName.war to targets  (upload=true) ...
You have an edit session in progress, hence WLST will not block for your deployment to complete.
Started the Deployment of Application. Please refer to the returned WLSTProgress object or variable LAST to track the status.
Current Status of your Deployment:
Deployment command type: deploy
Deployment State : running
Deployment Message : [Deployer:149140]The task cannot be processed further until the current edit session is activated. When this occurs, task processing will continue. The user can exit the deployer tool without affecting the task.
Saving all your changes ...
Saved all your changes successfully.
Activating all your changes, this may take a while ... 
The edit lock associated with this edit session is released once the activation is completed.
Activation completed
Disconnected from weblogic server: AdminServer

Exiting WebLogic Scripting Tool.