Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Topics of Discussion
What is WLST? Modes of Operation Features Online and Offline WLST Advantages of WLST MBean Create Domain through WLST Demo FAQs
Puzzle
1. 2. 3. 4. 5.
Interactive, Scripting OOPS Language True Weblogic Scripting Tool Embedded, Script, Interactive
WLST - Weblogic Scripting Tool Python - OOPS Language Jython - Embedded scripting language Mode of WLST Interaction - Interactive, Scripting and Embedded WLST Case Sensitive - true
What is WLST?
Monitor, Manage & Configure WebLogic Server (online/offline) Based on Jython Similar to any programming language Built on Jython 2.1 Simple & clear syntax Use jython libraries Fast in performance Platform Independent
Includes capabilities of
Modes of Operation
1. Interactive
Navigation/Interrogation
Modes of Operation
2. Script
Sequence of commands via
Modes of Operation
3. Embedded
Uses Jython libraries
Different ways:
1. java weblogic.WLST filePath.py
c:\> java weblogic.WLST Initializing WebLogic Scripting Tool (WLST) ... ... ... wls:/(offline)> execfile('c:/temp/example.py') starting the script ...
WLST is a JMX client Access to Managed Beans (MBeans). Navigate and interrogate MBeans Browsing the MBean hierarchy on connecting to a Server instance
BEA Systems recommends changes in the values of configuration MBeans on the Administration Server but not on Managed Server
Control Commands - connect, disconnect, exit Commands and arguments are case sensitive Use only forward slash (/) in a file pathname:
cd (c:/temp/mytemplate.jar')
Following characters are not valid in object names: (.), (/), (\)
wls:/mydomain/serverConfig> help('disconnect')
help('get*')
Features -Advantages
Easily move resources from one Domain to another
Make reliable changes to config.xml without a running server Use WLST in conjunction with any java utility tools (e.g. ant, jython scripts) Extend WLST to add any Custom commands WLST helps in retrieving MBeans names in a similar fashion to navigating hierarchy of files in a file system.
closeTemplate() exit()
Server name > Domain name > URL > username > password > path of the domain directory > block user interaction while server startup > server log > system properties > jvm arguments
Using Node Manager to start the Admin Server helps starting, stopping and restarting it if it fails Starting Managed Servers and Clusters With Node Manager startNodeManager(verbose='true', NodeManagerHome='D:/bea10.2/wlserver_10.0/common/nodemanager', ListenPort=5556')
Connect(weblogic,weblogic,t3://localhost:7001) wls:/mydomain/serverConfig>start('managed1','Server','t3://localhost:7701')
Using WLST and Node Manager to Manage Servers Start Node Manager Connect WLST to Node Manager
nmConnect('weblogic', 'weblogic', 'localhost', '5556','mydomain', 'c:/bea/user_projects/domains/mydomain')
Start an Administration Server wls:/nm/mydomain>nmStart('serverName') Monitor the status of the server you started by entering the nmServerStatus command. wls:/nm/mydomain>nmServerStatus('serverName') Stop the server wls:/nm/mydomain>nmKill('serverName')
WLST deploys application to a WebLogic Server instance similar to weblogic.Deployer utility. The deploy command returns a WLSTProgress object that can be used to check the status. Deploy
application name path of the ear or war file target plan path (deployment plan file ) options
connect('weblogic','weblogic','t3://localhost:7010'); print 'Status',state('AdminServer','Server'); print 'Status',state('MS1','Server'); print 'Status',state('MS2','Server'); print 'Status',state('MS3','Server'); print 'Status',state('MS4','Server'); disconnect();
connect(weblogic,weblogic,t3://localhost:7010) ls() cd(Servers) cd(MS1) ls() edit() startEdit() set (IdlePeriodsUntilTimeout,10) save() activate()
cd('/ServerRuntimes/'+sname+'/JVMRuntime/'+sname) cmo.runGC()
connect() // connect to the domain cd(Servers/MS1) edit() cd(JDBCSystemResources) cd(samplesDataSource) cd(JDBCResource) cd(samplesDataSource) cd(JDBCDriverParams) cd(samplesDataSource) set('PasswordEncrypted', 'PBPUBLIC') Save() Activate()
connect() // connect to the domain domainRuntime() cd('ServerRuntimes/AdminServer/ThreadPoolRuntime/ ThreadPoolRuntime') ls() // it will list all the thread pool information
Retrieivng the StuckThreadCount using WLST. Can be retrieved using WLST from the path connect() // connect to the domain domainRuntime() cd(' ServerRuntimes/SERVERNAME/WorkManagerRuntimes/ DataRetirementWorkManager/ StuckThreadCount ')
a)
startServer('AdminServer', 'mydomain', username='weblogic', password='weblogic', block='true', timeout=300000, serverLog='./test-right.log', systemProperties='weblogic.ListenPort=14521', jvmArgs='-Xms256m -Xmx512m -XX:MaxPermSize=128m') To summarize, a) You should specify url in the startServer command OR You should specify weblogic.ListenPort in the systemProperties of the startServer() command.
print 'Status',state('MS1','Server'); print 'Status',state('MS2','Server'); print 'Status',state('MS3','Server'); print 'Status',state('MS4','Server'); startServer('AdminServer','mydomain','t3://localhost:7001', 'weblogic','weblogic','c:/bea/user_projects/domains/mydomain','true)
# Node Manager needs to be running to run this script. connect('weblogic','weblogic','t3://localhost:7010') domainRuntime() slrBean = cmo.lookupServerLifeCycleRuntime('MS1') status = slrBean.getState() print 'Status of Managed Server is '+status if status != "RUNNING": start('MS1', block="true") print 'Starting server MS1'
nmConnect('weblogic', 'weblogic', 'localhost','5556','WLST','D:/bea10.2/user_projects/domains/WLST') a = nmServerStatus('AdminServer') print a b=1 while b == 1: if a == "RUNNING": b=0 connect('weblogic','weblogic','t3://localhost:7010') print 'Successfully connected' else: a = nmServerStatus('AdminServer') print 'Starting Admin Server'
cd('/Security/domainname/User/username') cmo.setPassword('password')
Connect(weblogic,weblogic,t3://loclahost:7001)
from weblogic.management.security.authentication import UserPasswordEditorMBean print "Changing password ..." atnr=cmo.getSecurityConfiguration().getDefaultRea lm().lookupAuthenticationProvider("DefaultAuthenti cator") atnr.changeUserPassword('weblogic','weblogic','web logic123')
# read the domain template readTemplate("D:/bea10.2/wlserver_10.0/common /templates/domains/wls.jar") setOption(ServerStartMode, prod) # create a domain writeDomain('D:/bea10.2/user_projects/domains/b asicWLSDomain') # close the template closeTemplate()
Thank You
Quest Time