Documente Academic
Documente Profesional
Documente Cultură
Objectives
At the end of this session, participant should be able to
Contents
Introduction to WLST
WLST Online or Offline
Interactive, Script , and Embedded Mode
WLST Commands
WLST sample scripts
WLST using ant
Embedded wlst sample
Introduction to WLST
The WebLogic Scripting Tool (WLST) is a command-line
scripting environment that you can use to create, manage,
and monitor WebLogic Server domains
It is based on the Java scripting interpreter, Jython
In addition to supporting standard Jython features such as
local variables, conditional variables, and flow control
statements, WLST provides a set of scripting functions
(commands) that are specific to WebLogic Server
User can extend the WebLogic scripting language to suit
his needs by following the Jython language syntax
10
Interactive Mode
11
Embedded Mode
Instantiate the WLST interpreter in your Java code and use it to
run WLST commands and scripts
All WLST commands and variables that you use in interactive and
script mode can be run in embedded mode
13
Embedded Mode
14
15
16
WLST Commands
17
Control Commands:
Connect to or disconnect from a server
Create and configure a WebLogic domain or domain template
Exit WLST
Deployment Commands:
Deploy, undeploy, and redeploy applications and standalone
modules to a WebLogic Server instance
Update an existing deployment plan
Interrogate the WebLogic Deployment Manager object
Start and stop a deployed application
18
Editing Commands:
Interrogate and edit configuration beans
Information Commands:
Interrogate domains, servers, and variables, and provide
configuration bean, runtime bean, and WLST-related information
Tree Commands:
Navigate among MBean hierarchies
19
Browse Commands
cd: (Online or Offline)
Navigate the hierarchy of configuration or runtime beans
currentTree: (Online)
Return the current tree location
20
Control Commands
connect: (Online or Offline)
Connect WLST to a WebLogic Server instance
disconnect: (Online)
Disconnect WLST from a WebLogic Server instance
createDomain: (Offline)
Create a new domain using the specified template
readTemplate: (Offline)
Open an existing domain template for domain creation
writeDomain: (Offline)
Write the domain configuration information to the specified
directory
closeTemplate: (Offline)
Close the current domain template
21
addTemplate: (Offline)
Extend the current domain using an application or service
extension template
updateDomain: (Offline)
Update and save the current domain
closeDomain: (Offline)
Close the current domain
writeTemplate: (Offline)
Writes the configuration information to the specified domain
template file
Deployment Commands
deploy: (Online)
Deploy an application to a WebLogic Server instance
distributeApplication: (Online)
Copy the deployment bundle to the specified targets
getWLDM: (Online)
Return the WebLogic DeploymentManager object
listApplications: (Online)
List all applications that are currently deployed in the domain
loadApplication: (Online)
Load an application and deployment plan into memory
redeploy: (Online)
Reload classes and redeploy a previously deployed application
23
stopApplication: (Online)
Stop an application, making it un available to users
undeploy: (Online)
Undeploy an application from the specified servers
updateApplication: (Online)
Update an application configuration using a new deployment plan
24
Diagnostics Commands
exportDiagnosticData: (Offline)
Execute a query against the specified log file
exportDiagnosticDataFromServer: (Online)
Execute a query on the server side and retrieves the exported
WebLogic Diagnostic Framework (WLDF) data
25
Editing Commands
activate: (Online or Offline)
Activate changes saved during the current editing session but not
yet deployed
assign: (Offline)
Assign resources to one or more destinations
assignAll: (Offline)
Assign all applications or services to one or more destinations
cancelEdit: (Online)
Cancel an edit session, release the edit lock, and discard all
unsaved changes
This operation can be called by any user with administrator
privileges, even if the user did not start the edit session
encrypt: (Online)
Encrypt the specified string
getActivationTask: (Online)
Return the latest ActivationTask MBean on which a user can get
status
Invoke: (Online)
Invoke a management operation on the current configuration bean
isRestartRequired: (Online)
Determine whether a server restart is required
27
save: (Online)
Save the edits that have been made but have not yet been saved
setOption: (Offline)
Set options related to a domain creation or update
showChanges: (Online)
Show the changes made by the current user during the current
edit session
28
stopEdit: (Online)
Stop the current edit session, release the edit lock, and discard
unsaved changes
unassign: (Offline)
Unassign applications or resources from one or more destinations
unassignAll: (Offline)
Unassign applications or resources from one or more destinations
undo: (Online)
Revert all unsaved or unactivated edits
Validate: (Online)
Validate the changes made but have not yet been saved
29
Information Commands
addListener: (Online)
Add a JMX listener to the specified Mbean
find: (Online)
Find MBeans and attributes in the current hierarchy
30
getMBean: (Online)
Return the MBean by browsing to the specified path
getMBI: (Online)
Return the MBeanInfo for the specified MBeanType or the cmo
variable
getPath: (Online)
Return the MBean path for the specified MBean instance
listChildTypes: (Online)
List all the children MBeans that can be created or deleted for the
cmo
31
man: (Online)
Display help from MBeanInfo for the current MBean or its specified
attribute
removeListener: (Online)
Remove a listener that was previously defined
showListeners: (Online)
Show all listeners that are currently defined
32
state: (Online)
Returns a map of servers or clusters and their state using Node
Manager
storeUserConfig: (Online)
Create a user configuration file and an associated key file
34
resume: (Online)
Resume a server instance that is suspended or in ADMIN state
shutdown: (Online)
Gracefully shut down a running server instance or cluster
start: (Online)
Start a Managed Server instance or a cluster using Node
Manager
suspend: (Online)
Suspend a running server
35
nmEnroll: (Online)
Enroll the machine on which WLST is currently running
nmGenBootStartupProps: (Online)
Generates the Node Manager property files, boot.properties and
startup.properties, for the specified server.
Tree Commands
config: (Online)
Navigate to the last MBean to which you navigated in the
configuration MBean hierarchy or to the root of all configuration
beans, DomainMBean
This command is deprecated as of WebLogic Server 9.0
custom: (Online)
Navigate to the root of custom MBeans that are registered in the
server
domainConfig: (Online)
Navigate to the last MBean to which you navigated in the domain
configuration hierarchy or to the root of the hierarchy,
DomainMBean
38
edit: (Online)
Navigate to the last MBean to which you navigated in the
configuration edit MBean hierarchy or to the root of the hierarchy,
DomainMBean
Jndi: (Online)
Navigates to the JNDI tree for the server to which WLST is
currently connected
runtime: (Online)
Navigate to the last MBean to which you navigated in the Runtime
hierarchy or the root of all runtime objects, DomainRuntimeMBean
This command is deprecated as of WebLogic Server 9.0
39
serverRuntime: (Online)
Navigate to the last MBean to which you navigated in the runtime
MBean hierarchy or to the root of the hierarchy,
ServerRuntimeMBean
40
cluster_deletion.py
Removes the clusters and servers created in cluster_creation.py
41
deleteJMSSystemResource.py
Removes the JMS System module created by
configJMSSystemResource.py
42
jdbc_data_source_deletion.py
Removes the JDBC data source created by
jdbc_data_source_creation.py
43
Output of cluster_creation.py
44
distributedQueues.py
Demonstrates two methods for creating distributed queues
The script uses the Basic WebLogic Server Domain template and
extends it using the Avitek Medical Records Sample
45
sampleMedRecDomain.py
Creates a domain that defines resources similar to those used in
the Avitek MedRec sample
This example does not recreate the MedRec example in its
entirety, nor does it deploy any sample applications
The script uses the Basic WebLogic Server Domain template
46
47
wlst Task
<taskdef name="wlst"
classname="weblogic.ant.taskdefs.management.WLSTTa
sk" />
Parameters:
properties="prop sFile"
Name and location of a properties file that contains name-value
pairs that you can reference in your WLST script
Required: No
fileName="fileName"
Name and location of the WLST script file that you would like to
execute
If the specified WLST script file does not exist, this task fails
Required: Yes, if no nested <script> is used
48
debug="value"
Boolean value specifying whether debug statements should be
output when this task is executed
Required: No
Default: false
49
failOnError="val ue"
Boolean value specifying whether the Ant build will fail if this task
fails
Required: No
Default: true
50
52
EmbeddedWLST.java
53
Summary
In this session we covered
Introduction to WLST
WLST Online or Offline
Interactive, Script , and Embedded Mode
WLST Commands
WLST sample scripts
WLST using ant
Embedded wlst sample
54