Undeploy/remove application from weblogic admin server (wlst/example)

  • Given weblogic application server.
  • Undeploy/remove application from weblogic admin server using WLST (WebLogic Scripting Tool).
  • We will execute deployment script from wlst console (oracle_common/common/bin/wlst.sh)

1. Steps required to remove/undeploy application from weblogic admin server:

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

2. WLST Script to remove/undeploy application from weblogic server:

def wlUnDeploy(username, password, adminURL, appName):
    try:
        #connect to admin server
        connect(username, password, adminURL)

        #start edit operation
        edit()
        startEdit()

        #stop application
        stopApplication(appName)

        #start deploying application to admin server
        progress = undeploy(appName, timeout=60000)
        progress.printStatus()
        save()
        activate(20000,block="true")

        #disconnect from Admin server
        disconnect()
        exit()
    except Exception, ex:
        print ex.toString()
        cancelEdit('y')

wlUnDeploy("weblogic","weblogic1","t3://myweblogic_server:7001","myAppName")
#wlUnDeploy("<Admin User Name>","<Password>","<AdminUrl","<App Name>")

3. Output: undeploy/remove application from weblogic server

Connecting to t3://myweblogic_server: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').
You already have an edit session in progress and hence WLST will 
continue with your edit session.

Starting an edit session ...
Started edit session, be sure to save and activate your changes once you are done.
Stopping application myAppName.
     
You have an edit session in progress, hence WLST will not block for your stopApplication to complete.
Stopped the Application. Please refer to the returned WLSTProgress object or variable LAST to track the status.
Undeploying application myAppName ...
     
You have an edit session in progress, hence WLST will not block for your undeployment to complete.
Started the undeployment of Application. Please refer to the returned WLSTProgress object or variable LAST to track the status.
Current Status of your Deployment:
Deployment command type: undeploy
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
Scroll to Top