Weblogic Scripting Tool (WLST) Fundamentals
WLS command-line tools are useful :
- As an alternative to the Administration Console
- When Graphical tools are not supported
WLST provides a command-line interface for :
- Retrieving and updating Weblogic Domain Configurations
- Deploying Applications
- Obtaining run-time server statistics
WLST is implemented using Jython which in turn is a Java implementation of the Python scripting Languages:
-indentation to structure code
-interactive command mode
-custom commands
-integration with any Java libraries
Using Jython
Jython can interpret commands in 3 ways :
- Interactive :Supply commands one at a time from a command promt
- Batch : Provides a series of commands in a script file ( .py)
- Embedded : Run Jython interpretor within a Java class
WLST Modes
Online mode:
- Connected to a running server
- Access to all Weblogic configuration and run-time attributes
- Create and activate change session similar to Admin console.
Offline Mode :
- Domain not working
- Access to only persisted domain configuration (config.xml)
- Create 0r update domain similar to using configuration wizard
Running WLST scripts
- use the setWLSEnv script to initialize the PATH and CLASSPATH required for WLST
- If no script file supplied WLSt will run in interactive mode.
- The execfile() command can be used to run scripts
>setWLSEnv.sh
>java weblogic.WLST [scriptfile.py]
To support SSL connection to a server
>java -Dweblogic.security.SSL.ignoreHostNameVerification=true -Dweblogic.security.TrustKyStore=DemoTrust weblogic.WLST
Generic WLST Commands
help - Get help for a given WLST commands
exit - Quit WLST
dumpVariables - Display all variables used by WLST
dumpStack - Display the stack trace of last error occurred in WLST
redirect/stopRedirect - Redirect all WLST output to a file.
Offline WLST Commands
createDomain -create domain by using given template
readDomain - open existing domain on the file system
readTemplate - open a existing domain template
addTemplate - apply template file to current domain
updateDomain - save changes to current domains
writeDomain - save changes to current domain in a specific directory
writeTemplate - save current domain to a template file
assign/unassign - target application to servers
setOption - configure domain creation options
WLST : Creating a Domain Example
Online WLST Commands
connect - connect to a server by supply credentials
disconnect - disconnect from the current server
shutdown - shut down server
start - use the node manager to start the servers
startEdit - Begin a new change session
stopEdit - Release the edit lock and discard any changes
activate - commit all changes in the current session
showChanges - List all changes made in current session
isRestartRequired - Determine if any changes required server restart
deploy/redeploy -Deploy an application to a server
undeploy - Shut down a running application on servers
Weblogic JMX : Overview
JMX MBeans:
- - are java objects found on the server
- - have attributes and operations
- - support the configurations, management and monitoring of all type of server resources
Navigating JMX MBeans
- Use the cd, ls and pwd commands to navigate server configurations or run-time MBeans, similar to a file system.
- Use get and set commands to read or update MBean attribute
- The cmo variable refer to the current MBean
0 Comments