Wednesday, November 18, 2009

WLST useful tips and tricks

Run a .py script with:

java weblogic.WLST scriptname.py


How to define a function with exception handling:

def connect_to_weblogic(username,password,adminurl):
try :
connect(username,password,adminurl)
except :
print 'Cannot connect to server '
exit()


How to get the list of defined servers:

serverList = ls('Servers',returnMap='true')

(the "returnMap" options makes the serverList variable a HashMap with key=serverName)


How to get a list of RUNNING servers:

domainRuntime()
runningList = ls('ServerRuntimes',returnMap='true')


No comments: