Check whether particular application is deployed in AdminServer (WLST)

By | March 19, 2019

1. AppDeployments in current domain of WebLogic Server.

  • Given the AdminServer (weblogic).
  • We would like check whether  given application is deployed in current domain.
    • We will traverse the AppDeployments in AdminServer.
    • If the application is deployed in AdminServer, then we would return True otherwise False.
  • We would connect to AdminServer using WLST (t3 protocol).

1. Program: Check application is deployed in AdminServer – Python/WLST:


def isDiffAppDeployed(appName):
    isAppDeployed=False
    try:
        cd('AppDeployments/'+appName)
        cd('/')
        isAppDeployed = True
    except Exception, e:
        pass

    return isAppDeployed

#Enter connection credentials
connect("adminUser","adminPassword","adminHostName:7001")

appName = 'myWebApp'
isAppDeployed=isDiffAppDeployed(appName)
if isAppDeployed:
    print ('Application ' + appName + ' is already deployed in AdminServer')
else:
    print ('Application ' + appName + ' is not deployed in AdminServer')

disconnect()     

3. Output: Check application is deployed in AdminServer – Python/WLST:


c:\fmw_12.2.1.3.0\wls12213\oracle_common\common\bin>wlst.cmd d:\myScripts\checkDeployment.py

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

Connecting to t3://slc07fic.us.oracle.com:7001 with userid weblogic ...
Successfully connected to Admin Server "AdminServer" that belongs to domain "my_domain".

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.

Application myWebApp is already deployed in AdminServer
Disconnected from weblogic server: AdminServer