WLST: Command and Variable Reference

Overview of WLST Command Categories

* Browse commands: Navigate the hierarchy of configuration or runtime beans and control the prompt display.
* Control commands:
– Connect/disconnect from a server.
– Create/configure a WebLogic domain or domain template.
– Exit WLST.
* Customization commands: Add the command group help and command help that is displayed by the WLST help() and help(‘commandGroup’) commands.
* Deployment commands:
– Deploy/undeploy/redeploy applications and standalone modules to a server instance.
– Update an existing deployment plan.
– Interrogate WebLogic Deployment Manager object.
– Start/stop a deployed application.
* Diagnostics commands: export diagnostic data.
* Editing commands: interrogate and edit config beans.
* Information commands: Interrogate WebLogic domains, servers, and variables, and provide configuration bean, runtime bean, and WLST-related information.
* Life cycle commands: manage the life cycle of a server instance.
* Node manager commands: start/stop/restart/monitor server instances using Node Manager.
* Tree commands: navigate among MBean hierarchies.

Start WLST

cd C:\prog\Oracle\Middleware\wlserver_10.3\common\bin
wlst.cmd

Browse Commands

cd

* Navigates the hierarchy of configuration or runtime beans.
* Similar to Unix cd command.
* Online or offline
* Syntax:

cd(mbeanName)

* Example:

connect('weblogic','welcome1','t3://localhost:7001') 
wls:/my_domain/serverConfig> cd('Servers')
wls:/my_domain/serverConfig/Servers> ls()
dr--   AdminServer
dr--   ManagedServer_1
dr--   ManagedServer_2
wls:/my_domain/serverConfig/Servers> cd('ManagedServer_1')
wls:/my_domain/serverConfig/Servers/ManagedServer_1> ls

currentTree

* Returns the current location in the hierarchy.
* This command enables you to store the current location in the hierarchy and easily return to it after browsing.
* In the event of an error, the command returns a WLSTException.
* Online only.
* Syntax:

currentTree()

* Example:

# List current dir
wls:/my_domain/serverConfig/Servers> ls()
dr--   AdminServer
dr--   ManagedServer_1
dr--   ManagedServer_2
 
# Remember current dir
wls:/my_domain/serverConfig/Servers> myTree=currentTree()
 
# Go to server runtime tree.
wls:/my_domain/serverConfig/Servers> serverRuntime()
Location changed to serverRuntime tree. This is a read-only tree with ServerRunt
imeMBean as the root.
For more help, use help(serverRuntime)
 
wls:/my_domain/serverRuntime> ls()
...
 
# Go back
wls:/my_domain/serverRuntime> myTree()
 
wls:/my_domain/serverConfig/Servers> ls
<function ls 3>
wls:/my_domain/serverConfig/Servers> ls()
dr--   AdminServer
dr--   ManagedServer_1
dr--   ManagedServer_2

prompt

* Toggles the display of path information at the prompt, when entered without an argument.
* This command is useful when the prompt becomes too long due to the length of the path.
* Online or offline
* Syntax:

prompt(off|on)

* Example:

wls:/my_domain/serverConfig/Servers> prompt()
wls:/> prompt()
wls:/my_domain/serverConfig/Servers> prompt('off')
>>>prompt()
wls:/> prompt()
wls:/my_domain/serverConfig/Servers>

pwd

* Displays the current location in the configuration or runtime bean hierarchy.
* Online or offline
* Syntax:

pwd()

* Example:

wls:/my_domain/serverConfig/Servers> pwd()
'serverConfig:/Servers'

Control Commands

addTemplate

* Extends the current WebLogic domain using an application or service extension template.
– Use the Template Builder to create an application or service extension template.
* Offline only.
* Syntax:

addTemplate(templateFileName)

* Example:

wls:/my_domain/serverConfig/Servers> disconnect()
Disconnected from weblogic server: AdminServer
wls:/offline> readDomain('C:/prog/Oracle/Middleware/user_projects/domains/my_domain')
wls:/offline/my_domain> pwd()
'/my_domain'
wls:/offline/my_domain> addTemplate('C:/prog/Oracle/Middleware/wlserver_10.3/common/templates/applications/wls_default.jar')
wls:/offline/my_domain>

closeDomain

* Closes the current domain.
– The domain is no longer available for editing once it is closed.
* Offline only.
* Syntax:

closeDomain()

* Example:

wls:/offline> readDomain('c:/Oracle/Middleware/user_projects/domains/medrec')
...
wls:/offline/medrec> updateDomain()
wls:/offline/medrec> closeDomain()
wls:/offline>

closeTemplate

* Closes the current domain template.
– The domain template is no longer available once it is closed.
* Offline only.
* Syntax:

closeTemplate()

* Example:

wls:/offline> readTemplate('c:/Oracle/Middleware/wlserver_10.3/common/templates/domains/wls.jar')
...
wls:/offline/wls> closeTemplate()
wls:/offline>

connect

* Connects WLST to a WebLogic Server instance.
* Online or offline
* Syntax:

connect([username, password], [url], [timeout])
connect([userConfigFile, userKeyFile], [url], [timeout])
connect([url], [adminServerName], [timeout])

* Example:

 

createDomain

* Creates a WebLogic domain using the specified template.
* Offline only.
* Syntax:

createDomain(domainTemplate, domainDir, user, password)

* Example:

wls:/offline> createDomain('c:/Oracle/Middleware/wlserver_10.3/common/templates/domains/wls_medrec.jar','c:/Oracle/Middleware/user_projects/domains/medrec', 'weblogic', 'welcome1')

disconnect

* Disconnects WLST from a WebLogic Server instance.
– The disconnect command does not cause WLST to exit the interactive scripting shell;
– it closes the current WebLogic Server instance connection and resets all the variables while keeping the interactive shell alive.
* Online only
* Syntax:

disconnect(force)

* Example:

wls:/mydomain/serverConfig> disconnect() 
Disconnected from weblogic server: myserver
wls:/offline>

exit

* Exits WLST from the user session and closes the scripting shell.
– If there is an edit session in progress, WLST prompts you for confirmation.
– To skip the prompt, set the defaultAnswer argument to y.
* Online or offline
* Syntax:

exit([defaultAnswer], [exitcode])

* Example:

wls:/mydomain/serverConfig> exit() 
Exiting WebLogic Scripting Tool ...
c:\>
 
wls:/mydomain/serverConfig> exit(exitcode=101) 
Exiting WebLogic Scripting Tool ...
c:\>

readDomain

* Opens an existing WebLogic domain for updating.
* Offline only.
* Syntax:

readDomain(domainDirName)

* Example:

wls:/offline> readDomain('C:/prog/Oracle/Middleware/user_projects/domains/my_domain')
wls:/offline/my_domain> pwd()
'/my_domain'

readTemplate

* Opens an existing domain template for domain creation.
* Offline only.
* Syntax:

readTemplate(templateFileName)

* Example:

wls:/offline> readTemplate('c:/Oracle/Middleware/wlserver_10.3/common/templates/domains/wls_medrec.jar') 
wls:/offline/wls_medrec>

updateDomain

* Updates and saves the current WebLogic domain.
– The domain continues to be editable after you update and save it.
* Offline only.
* Syntax:

updateDomain()

* Example:

wls:/offline> readDomain('c:/Oracle/Middleware/user_projects/domains/medrec') 
...
wls:/offline/medrec> updateDomain()

writeDomain

* Writes the domain configuration information to the specified directory.
– Once you write the WebLogic domain to file system, you can continue to update the domain template object that exists in memory, and reissue the writeDomain command to store the domain configuration to a new or existing file.
– By default, when you write a WebLogic domain, the associated applications are written to WL_HOME/user_projects/applications/domainname
– When you have finished using the domain template object in memory, close it using the closeTemplate command. If you want to edit the WebLogic domain that has been saved to disk, you can open it using the readDomain command.
– Before writing the domain, you must define a password for the default user, if it is not already defined. For example:

cd('/Security/base_domain/User/weblogic')
cmo.setPassword('welcome1')

* Offline only.
* Syntax:

writeDomain(domainDir)

* Example:

wls:/offline> readTemplate('c:/Oracle/Middleware/wlserver_10.3/common/templates/domains/wls.jar') 
...
wls:/offline/base_domain> writeDomain('c:/Oracle/Middleware/user_projects/domains/base_domain')

writeTemplate

* Writes the domain configuration information to the specified domain template.
– You can use the domain configuration template to recreate the WebLogic domain.
* Offline only.
* Syntax:

writeTemplate(templateName)

* Example:

wls:/offline> readDomain('c:/Oracle/Middleware/user_projects/domains/mydomain') 
...
wls:/offline/base_domain> writeTemplate('c:/Oracle/Middleware/user_projects/templates/myTemplate.jar')

Samples

* WL_HOME\common\templates\scripts\wlst\basicWLSDomain.py

# Open domain template:
readTemplate("C:/prog/Oracle/Middleware/wlserver_10.3/common/templates/domains/wls.jar")
 
# Configure admin server:
cd('Servers/AdminServer')
set('ListenAddress','') # Leave blank for server instance to decide
set('ListenPort', 7001)
 
# Configure admin server SSL connection information:
create('AdminServer','SSL')
cd('SSL/AdminServer')
set('Enabled', 'True')
set('ListenPort', 7002)
 
# Set weblogic password.
cd('/')
cd('Security/base_domain/User/weblogic')
cmo.setPassword('welcome1')
 
# Write the domain
setOption('OverwriteDomain', 'true')
writeDomain('C:/prog/Oracle/Middleware/user_projects/domains/basicWLSDomain')
 
# Close the domain template.
closeTemplate()
 
# Exit WLST.
exit()

Customization Commands

addHelpCommandGroup

* Adds a new command help group to those shown by the WLST help() command, and specifies the resource bundle in which the help information is defined for the group.
* Online or offline
* Syntax:

addHelpCommandGroup(commandGroup, resourceBundleName)

* Example:

addHelpCommandGroup('boot','myhelp')
addHelpCommandGroup('boot','foo.bar.MyResourceBundleClass')

addHelpCommand

* Adds new command help for a command to an existing command group.
– Once added to the group, the command (along with a brief description) is displayed in the command list for the group when you enter the help(‘commandGroup’) command. – You can also specify whether or not the command is listed by the help(‘online’) and help(‘offline’) commands.
* Online or offline
* Syntax:

addHelpCommand(commandName,commandGroup,[offline=false, online=false])

* Example:

addHelpCommand('bootDB','boot',online='true',offline='false')

Deployment Commands

deploy

* Deploys an application to a WebLogic Server instance.
* Online or offline
* Syntax:

deploy(appName, path, [targets], [stageMode], [planPath], [options])

– appName: Name of the application or standalone Java EE module to be deployed.
– path: Name of the application directory, archive file, or root of the exploded archive directory to be deployed.
– targets: Comma-separated list of the targets. Defaults to the server to which WLST is currently connected.
– stageMode: Valid values are stage, nostage, and external_stage.
– planPath: Name of the deployment plan file. The filename can be absolute or relative to the application directory. This argument defaults to the plan/plan.xml file in the application directory, if one exists.
– options: Comma-separated list of deployment options, specified as name-value pairs.
* Example:

wls:/offline> connect('weblogic','welcome1','t3://localhost:7001')
Connecting to t3://localhost:7001 with userid weblogic ...
Successfully connected to Admin Server 'AdminServer' that belongs to domain 'basicWLSDomain'.
 
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.
 
wls:/basicWLSDomain/serverConfig> cd('Servers')
wls:/basicWLSDomain/serverConfig/Servers> ls
<function ls 1>
wls:/basicWLSDomain/serverConfig/Servers> ls()
dr--   AdminServer
 
wls:/basicWLSDomain/serverConfig/Servers> progress= deploy(appName='jspExpApp',path='C:/TEMP/deploy/prod/myapp/1.0/app/jspExpressionEar.ear')
Deploying application from C:\TEMP\deploy\prod\myapp\1.0\app\jspExpressionEar.ear to targets  (upload=false) ...
<Sep 20, 2011 3:21:16 PM EDT> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating deploy operation for application, jspExpApp [archive: C:\TEMP\deploy\prod\myapp\1.0\app\jspExpressionEar.ear], to AdminServer .>
.Completed the deployment of Application with status completed
Current Status of your Deployment:
Deployment command type: deploy
Deployment State       : completed
Deployment Message     : no message
wls:/basicWLSDomain/serverConfig/Servers> progress.printStatus()
Current Status of your Deployment:
Deployment command type: deploy
Deployment State       : completed
Deployment Message     : no message
wls:/basicWLSDomain/serverConfig/Servers>

distributeApplication

* Copies the deployment bundle to the specified targets.
– The deployment bundle includes module, configuration data, and any additional generated code.
– The distributeApplication command does not start deployment.
* Online only.
* Syntax:

distributeApplication(appPath, [planPath], [targets], [options])

* Example:

wls:/offline> progress=distributeApplication('c:/myapps/BigApp', 
'c:/deployment/BigApp/plan.xml', 'myserver,oamserver1,oamcluster')
Distributing Application and Plan ...
Successfully distributed the application.

getWLDM

* Returns the WebLogic DeploymentManager object.
* Online only.
* Syntax:

getWLDM()

* Example:

wls:/basicWLSDomain/serverConfig/Servers> wldm=getWLDM()
wls:/basicWLSDomain/serverConfig/Servers> wldm.isConnected()
1

listApplications

* Lists all applications that are currently deployed in the WebLogic domain.
* Online
* Syntax:

listApplications()

* Example:

wls:/basicWLSDomain/serverConfig/Servers> listApplications()
 jspExpApp

loadApplication

* Loads an application and deployment plan into memory.
– Returns a WLSTPlan object that you can access to make changes to the deployment plan.
* Online
* Syntax:

loadApplication(appPath, [planPath], [createPlan])

– createPlan: default to true.
* Example:

wls:/basicWLSDomain/serverConfig/Servers>  myPlan=loadApplication('C:/TEMP/deploy/prod/myapp/1.0/app/jspExpressionEar.ear', 'C:/TEMP/deploy/prod/myapp/1.0/app/plan.xml')
Loading application from C:/TEMP/deploy/prod/myapp/1.0/app/jspExpressionEar.ear
...
Plan for your application will be written to C:\TEMP\deploy\prod\myapp\1.0\app\plan.xml
<Sep 20, 2011 3:45:01 PM EDT> <Info> <J2EE Deployment SPI> <BEA-260072> <Saved configuration for application, jspExpressionEar.ear>
Loaded application from C:\TEMP\deploy\prod\myapp\1.0\app\jspExpressionEar.ear and the deployment plan from C:\TEMP\deploy\prod\myapp\1.0\app\plan.xml
The WLSTPlan object is assigned to variable wlstPlan_jspExpressionEar_ear.
wls:/basicWLSDomain/serverConfig/Servers> myPlan.showVariables()
None of the plan variables have been over-written
wls:/basicWLSDomain/serverConfig/Servers>

redeploy

* Reloads classes and redeploys a previously deployed application.
* Online
* Syntax:

redeploy(appName, [planPath], [options])

– planPath: default to plan/plan.xml file in the application directory, if one exists.
– options: see deploy options. In addition:
~ appPath: Name of the archive file or root of the exploded archive directory to be redeployed.
~ deploymentPrincipalName: String value specifying the principal for redeploying the file or archive during server starts. You can use this option to overwrite the current in the config.xml file.
* Example:

wls:/basicWLSDomain/serverConfig/Servers> progress=redeploy('jspExpApp', 'C:/TEMP/deploy/prod/myapp/1.0/app/plan.xml')
Redeploying application jspExpApp ...
<Sep 20, 2011 3:53:13 PM EDT> <Warning> <WebLogicDescriptorWL> <BEA-2156000> <"config-root" C:\Users\ming-lj\AppData\Local\Temp\Ming-LJ\.\config\deployments\jspExpressionEar.ear\plan was not found>
<Sep 20, 2011 3:53:13 PM EDT> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating redeploy operation for application, jspExpApp [archive: null], to AdminServer .>
.Completed the redeployment of Application with status completed
Current Status of your Deployment:
Deployment command type: redeploy
Deployment State       : completed
Deployment Message     : no message
wls:/basicWLSDomain/serverConfig/Servers> progress.getState()
'completed'
wls:/basicWLSDomain/serverConfig/Servers>

startApplication

* Starts an application, making it available to users.
– The application must be fully configured and available in the WebLogic domain.
– Returns a WLSTProgress object that you can access to check the status of the command.
* Online
* Syntax:

startApplication(appName, [options])

* Example:

wls:/basicWLSDomain/serverConfig/Servers> progress=startApplication('jspExpApp')
 
Starting application jspExpApp.
<Sep 20, 2011 4:05:39 PM EDT> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating start operation for application, jspExpApp [archive: null], to AdminServer .>
.Completed the start of Application with status completed
Current Status of your Deployment:
Deployment command type: start
Deployment State       : completed
Deployment Message     : no message
wls:/basicWLSDomain/serverConfig/Servers> progress.getState()
'completed'

stopApplication

* Stops an application, making it unavailable to users.
– Returns a WLSTProgress object that you can access to check the status of the command.
* Online
* Syntax:

stopApplication(appName, [options])

* Example:

wls:/basicWLSDomain/serverConfig/Servers> progress=stopApplication('jspExpApp')
Stopping application jspExpApp.
<Sep 20, 2011 4:07:03 PM EDT> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating stop operation for application, jspExpApp [archive: null], to AdminServer .>
 
Completed the stop of Application with status completed
Current Status of your Deployment:
Deployment command type: stop
Deployment State       : completed
Deployment Message     : no message
wls:/basicWLSDomain/serverConfig/Servers> progress.isRunning()
0
wls:/basicWLSDomain/serverConfig/Servers>

undeploy

* Undeploys an application from the specified servers.
– Returns a WLSTProgress object that you can access to check the status of the command.
* Online only.
* Syntax:

undeploy(appName,[targets],[options])

* Example:

wls:/basicWLSDomain/serverConfig/Servers> undeploy('jspExpApp')
Undeploying application jspExpApp ...
<Sep 20, 2011 3:17:57 PM EDT> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating undeploy operation for application, jspExpApp [archive: null], to AdminServer .>
.Completed the undeployment of Application with status completed
Current Status of your Deployment:
Deployment command type: undeploy
Deployment State       : completed
Deployment Message     : no message
wls:/basicWLSDomain/serverConfig/Servers>

updateApplication

* Updates an application configuration using a new deployment plan.
– Returns a WLSTProgress object that you can access to check the status of the command.
* Online
* Syntax:

updateApplication(appName, [planPath], [options])

* Example:

progress=updateApplication('jspExpApp', 'C:/TEMP/deploy/prod/myapp/1.0/app/plan.xml')

Diagnostics Commands

exportDiagnosticData

* Executes a query against the specified log file.
– The results are saved to an XML file.
* Online
* Syntax:

exportDiagnosticData([options])

– options:
~ beginTimestamp—Timestamp (inclusive) of the earliest record to be added to the result set. This option defaults to 0.
~ endTimestamp—Timestamp (exclusive) of the latest record to be added to the result set. This option defaults to Long.MAX_VALUE.
~ exportFileName—Name of the file to which the data is exported. This option defaults to export.xml.
~ logicalName—Logical name of the log file being read. Valid values include: HarvestedDataArchive, EventsDataArchive, ServerLog, DomainLog, HTTPAccessLog, WebAppLog, ConnectorLog, and JMSMessageLog. This option defaults to ServerLog.
~ logName—Base log filename containing the log data to be exported. This option defaults to myserver.log.
~ logRotationDir—Directory containing the rotated log files. This option defaults to “.” (the same directory in which the log file is stored).
~ query—Expression specifying the filter condition for the data records to be included in the result set. This option defaults to “” (empty string), which returns all data.
~ storeDir—Location of the diagnostic store for the server. This option defaults to ../data/store/diagnostics.
* Example:

wls:/offline/mydomain>exportDiagnosticData(logicalName='ServerLog',  
logName='myserver.log', exportFileName='myExport.xml')
{'elfFields': '', 'logName': 'myserver.log', 'logRotationDir': '.',
'endTimestamp': 9223372036854775807L, 'exportFileName': 'export.xml',
'storeDir': '../data/store/diagnostics', 'logicalName': 'ServerLog',
'query': '', 'beginTimestamp': 0}

exportDiagnosticDataFromServer

* Executes a query on the server side and retrieves the exported WebLogic Diagnostic Framework (WLDF) data.
– The results are saved to an XML file.
* Online
* Syntax:

exportDiagnosticDataFromServer([options])

– Options:
~ beginTimestamp: default to 0.
~ endTimestamp: default to Long.MAX_VALUE.
~ exportFileName: default to export.xml.
~ logicalName: default to ServerLog.
~ query: defaults to “” (empty string), which returns all data.
* Example:

wls:/mydomain/serverRuntime> exportDiagnosticDataFromServer(logicalName="HTTPAccessLog", exportFileName="myExport.xml")

getAvailableCapturedImages

* Returns, as an array of strings, a list of the previously captured diagnostic images that are stored in the image destination directory configured on the server.
– The default directory is SERVER\logs\diagnostic_images.
* Online
* Syntax:

getAvailableCapturedImages()

* Example:

wls:/mydomain/serverRuntime>images=getAvailableCapturedImages()
Connecting to http://localhost:7001 with userid weblogic ...
wls:/mydomain/serverRuntime>print images [ 'diagnostic_image_myserver_2009_06_15_14_58_36.zip' ]

saveDiagnosticImageCaptureFile

* Downloads the specified diagnostic image capture from the server to which WLST is currently connected.
* Online
* Syntax:

saveDiagnosticImageCaptureFile(imageName, [outputFile])

– outputFile: defaults to imageName in current directory.
* Example:

wls:/mydomain/serverRuntime>images=getAvailableCapturedImages()
wls:/mydomain/serverConfig> saveDiagnosticImageCaptureFile(images[0])
wls:/mydomain/serverConfig> saveDiagnosticImageCaptureFile(images[0], 'mylocalimg.zip')

saveDiagnosticImageCaptureEntryFile

* Downloads a specific entry from the diagnostic image capture that is located on the server to which WLST is currently connected.
* Online
* Syntax:

saveDiagnosticImageCaptureEntryFile(imageName, imageEntryName, [outputFile])

– imageEntryName: Name of the specific entry to be retrieved from the diagnostic image capture. This can be one of the following:

image.summary
JTA.img
JRockitFlightRecorder.jfr
WatchSource.img
configuration.img
WORK_MANAGER.img
JNDI_IMAGE_SOURCE.img
APPLICATION.img
InstrumentationImageSource.img
SAF.img
Logging.img
PERSISTENT_STORE.img
JDBC.img
PathService.img
JMS.img
Deployment.img
JVM.img
CONNECTOR.img

– outputFile: defaults to imageEntryName in current working directory.
* Example:

wls:/mydomain/serverRuntime>images=getAvailableCapturedImages()
wls:/mydomain/serverConfig> saveDiagnosticImageCaptureEntryFile(images[0], 'image.summary')
wls:/mydomain/serverConfig> saveDiagnosticImageCaptureEntryFile(images[0], 'image.summary', 'myimage.summary')

Editing Commands

activate

* Activates changes saved during the current editing session but not yet deployed.
– This command prints a message if a server restart is required for the changes that are being activated.
– Returns the latest ActivationTask MBean which reflects the state of changes that a user is currently making or has made recently. You can then invoke methods to get information about the latest Configuration Manager activate task in progress or just completed.
* Online
* Syntax:

activate([timeout], [block])

– timeout: defaults to 30000 (5 min). -1 to never time out.
– block: whether WLST should block user interaction until the command completes. Defaults to false.
* Example:

wls:/mydomain/edit !> activate(200000, block='true')

assign

* Assigns resources to one or more destinations.
* Online
* Syntax:

assign(sourceType, sourceName, destinationType, destinationName)

– sourceType: Type of configuration bean to be assigned. This value can be set to one of the following values:
~ AppDeployment
~ Library
~ securityType (such as User)
~ Server
~ service (such as JDBCSystemResource)
~ service.SubDeployment, where service specifies the service type of the SubDeployment (such as JMSSystemResource.SubDeployment); you can also specify nested subdeployments (such as AppDeployment.SubDeployment.SubDeployment)
– sourceName: Name of the resource to be assigned. Multiple names can be specified, separated by commas, or you can use the wildcard (*) character to specify all resources of the specified type.
– destinationType: Type of destination.
– destinationName
* Use the following guidelines for setting the sourceType and destinationType:

– When assigning application deployments, set the values as follows:
~ sourceType: AppDeployment
~ destinationType: Target
– When assigning libraries, set the values as follows:
~ sourceType: Library
~ destinationType: Target
– When assigning services, set the values as follows:
~ sourceType: Name of the specific server, such as JDBCSystemResource
~ destinationType: Target
– When assigning servers to clusters, set the values as follows:
~ sourceType: Server
~ destinationType: Cluster
– When assigning subdeployments, set the values as follows:
~ sourceType: service.SubDeployment, where service specifies the parent of the SubDeployment, such as JMSSystemResource.SubDeployment; you can also specify nested subdeployments (such as AppDeployment.SubDeployment.SubDeployment)
~ destinationType: Target
– When assigning security types, set the values as follows:
~ sourceType: Name of the security type, such as User
~ destinationType: Name of the destination security type, such as Group
* Example:

# Assign the servers myServer and myServer2 to the cluster myCluster.
wls:/offline/mydomain> assign("Server", "myServer,myServer2", "Cluster", "myCluster") 
# Assign all servers to the cluster myCluster.
wls:/offline/mydomain> assign("Server", "*", "Cluster", "myCluster") 
# Assign the application deployment myAppDeployment to the target server newServer.
wls:/offline/mydomain> assign("AppDeployment", "myAppDeployment", "Target", "newServer") 
# Assign the user newUser to the group Monitors.
wls:/offline/mydomain> assign("User", "newUser", "Group", "Monitors") 
# Assign the SubDeployment myQueueSubDeployment, which is a child of the JMS resource myJMSResource, to the target server newServer.
wls:/offline/mydomain> assign('JMSSystemResource.SubDeployment', 
# Assign the nested SubDeployment MedRecAppScopedJMS.MedRecJMSServer, which is a child of the AppDeployment AppDeployment, to the target server AdminServer.
wls:/offline/mydomain>assign('AppDeployment.SubDeployment.SubDeployment','MedRecEAR.MedRecAppScopedJMS.MedRecJMSServer','Target','AdminServer')

cancelEdit

* Cancels an edit session, releases the edit lock, and discards all unsaved changes.
* Online
* Syntax:

cancelEdit([defaultAnswer])

– defaultAnswer: y or n. Defaults to null.
* Example:

wls:/mydomain/edit !> cancelEdit() 
Sure you would like to cancel the edit session? (y/n)y
Edit session is cancelled successfully

create

* Creates a configuration bean of the specified type for the current bean.
– Returns a stub for the newly created configuration bean.
– Must be connected to an Administration Server.
– Cannot use the create command for runtime MBeans
– Must navigate to the edit configuration MBean hierarchy using the edit command before issuing this command.
* Online or offline.
* Syntax:

create(name, childMBeanType, [baseProviderType])

* Example:

wls:/basicWLSDomain/serverConfig/Servers> edit()
Location changed to edit tree. This is a writable tree with
DomainMBean as the root. To make changes you will need to start
an edit session via startEdit().
 
For more help, use help(edit)
wls:/basicWLSDomain/edit> startEdit()
Starting an edit session ...
Started edit session, please be sure to save and activate your
changes once you are done.
wls:/basicWLSDomain/edit !> server1=create('newServer','Server')
MBean type Server with name newServer has been created successfully.
wls:/basicWLSDomain/edit !> server1.getName()
'newServer'
wls:/basicWLSDomain/edit !>

delete

* Deletes an instance of a configuration bean of the specified type for the current configuration bean.
– You can only delete configuration beans that are children of current Configuration Management Object (cmo) type.
* Online or offline
* Syntax:

delete(name, childMBeanType)

* Example:

wls:/basicWLSDomain/edit> startEdit()
Starting an edit session ...
Started edit session, please be sure to save and activate your
changes once you are done.
wls:/basicWLSDomain/edit !> delete('newServer','Server')
MBean type Server with name newServer has been deleted successfully.
wls:/basicWLSDomain/edit !> activate()
Activating all your changes, this may take a while ...
The edit lock associated with this edit session is released
once the activation is completed.
Activation completed

encrypt

* Encrypts the specified string.
– You can then use the encrypted string in your configuration file or as an argument to a command.
* Online
* Syntax:

encrypt(obj, [domainDir])

* Example:

wls:/basicWLSDomain/serverConfig> es=encrypt('password', 'C:/prog/Oracle/Middlew
are/user_projects/domains/basicWLSDomain')
wls:/basicWLSDomain/serverConfig> print es
{AES}S/cZp/b2Iz4UQbov5KeKxTy9rHycRX7kYc4r1aHa2PU=
wls:/basicWLSDomain/serverConfig>

get

* Returns the value of the specified attribute.
– Alternatively, you can use the cmo variable to perform any get method on the current configuration bean. For example:

cmo.getListenPort()

* Online or offline
* Syntax:

get(attrName)

* Example:

wls:/basicWLSDomain/serverConfig> get('AdministrationPort')
9002
 
wls:/basicWLSDomain/serverConfig> cmo.getAdministrationPort()
9002

getActivationTask

* Return the latest ActivationTask MBean on which a user can get status.
– The ActivationTask MBean reflects the state of changes that a user has made recently in WLST.
– You can then invoke methods to get information about the latest Configuration Manager activate task in progress or just completed.
* Online
* Syntax:

getActivationTask()

* Example:

wls:/basicWLSDomain/edit !> task=getActivationTask()
wls:/basicWLSDomain/edit !> task.getState()
4

invoke

* Invokes a management operation on the current configuration bean.
* Online
* Syntax:

invoke(methodName, parameters, signatures)

* Example:

wls:/mydomain/config> objs = jarray.array([java.lang.String("oamserver")],java.lang.Object) 
wls:/mydomain/edit> strs = jarray.array(["java.lang.String"],java.lang.String) 
wls:/mydomain/edit> invoke('lookupServer',objs,strs) 
true

isRestartRequired

* Determines whether a server restart is required.
* Online
* Syntax:

isRestartRequired([attributeName])

* Example:

wls:/basicWLSDomain/edit !> isRestartRequired()
 
Server re-start is NOT REQUIRED for the set of changes in progress.
wls:/basicWLSDomain/edit !> isRestartRequired("ConsoleEnabled")
 
Server re-start is REQUIRED if you change the attribute ConsoleEnabled

loadDB

* Loads SQL files into a database.
– The loadDB command loads the SQL files from a template file.
– This command can only be issued after a domain template or extension template has been loaded into memory
* Offline
* Syntax:

loadDB(dbVersion, datasourceName, dbCategory)

* Example:

wls:/offline/mydomain> loadDB('5.1', 'p13nDataSource', 'Drop/Create P13N Database Objects')

loadProperties

* Loads property values from a file and makes them available in the WLST session.
– This command cannot be used when you are importing WLST as a Jython module
* Online or offline
* Syntax:

loadProperties(fileName)

* Example:

wls:/mydomain/serverConfig> loadProperties('c:/temp/myLoad.properties')

save

* Saves the edits that have been made but have not yet been saved.
– This command is only valid when an edit session is in progress.
* Online
* Syntax:

save()

* Example:

wls:/basicWLSDomain/edit !> save()
Saving all your changes ...
Saved all your changes successfully.
wls:/basicWLSDomain/edit !>

set

* Sets the value of a specified attribute in the current management object.
– When using WLST offline, this command writes the attribute value to the domain configuration files.
– When using WLST online, this command sets the value of an MBean attribute. Online changes are written to the domain configuration file when you activate your edits.
– As an alternative to this command, you can use the cmo variable with the following syntax:
cmo.setattrName(value)
* Online or offline
* Syntax:

set(attrName, value)

* Example:

cd('Servers/AdminServer')
set('ListenAddress','')
set('ListenPort', 7001)
 
create('AdminServer','SSL')
cd('SSL/AdminServer')
set('Enabled', 'True')
set('ListenPort', 7002)

setOption

* Sets options related to a WebLogic domain creation or update.
* Offline
* Syntax:

setOption(optionName, optionValue)

– optionName: Name of the option to set.
Available options for domain creation include:
~ CreateStartMenu: Windows only. Defaults to true.
~ DomainName: defaults to domain directory name.
~ JavaHome
~ OverwriteDomain: defaults to false.
~ ServerStartMode: dev or prod. Defaults to dev.
Available options for domain updates include:
~ AllowCasualUpdate: defaults to true.
~ ReplaceDuplicates: defaults to true.
Available options for both domain creation and domain updates include:
~ AppDir: defaults to WL_HOME/user_projects/applications/domainname
~ AutoAdjustSubDeploymentTarget: defaults to true
~ AutoDeploy: whether to activate auto deployment when a cluster or multiple Managed Servers are created. Defaults to true.
* Example:

wls:/offline> setOption('CreateStartMenu', 'false')

showChanges

* Shows the changes made to the configuration by the current user during the current edit session.
* Online
* Syntax:

showChanges([onlyInMemory])

– onlyInMemory: defaults to false.
* Example:

wls:/basicWLSDomain/edit !> showChanges()
wls:/basicWLSDomain/edit !>

startEdit

* Starts a configuration edit session on behalf of the currently connected user.
– You must navigate to the edit configuration MBean hierarchy using the edit command before issuing this command.
* Online
* Syntax:

startEdit([waitTimeInMillis], [timeoutInMillis], [exclusive])
- waitTimeInMillis: defaults to 0 ms.
- timeOutInMillis: defaults to -1 ms.
- exclusive: defaults to false.

* Example:

wls:/basicWLSDomain/edit> startEdit()
Starting an edit session ...
Started edit session, please be sure to save and activate your
changes once you are done.
wls:/basicWLSDomain/edit !>

stopEdit

* Stops the current edit session, releases the edit lock, and discards unsaved changes.
* Online
* Syntax:

stopEdit([defaultAnswer])

– defaultAnswer: defaults to null.
* Example:

wls:/basicWLSDomain/edit !> stopEdit()
Sure you would like to stop your edit session? (y/n)y
Edit session has been stopped successfully.
wls:/basicWLSDomain/edit>

unassign

* Unassign applications or resources from one or more destinations.
* Offline
* Syntax:

unassign(sourceType, sourceName, destinationType, destinationName)

* Example:

wls:/offline/medrec> unassign("Server", "myServer,myServer2", "Cluster", "myCluster") 
wls:/offline/mydomain> unassign("Server", "*", "Cluster", "myCluster") 
wls:/offline/medrec> unassign("User", "newUser", "Group", "Monitors") 
wls:/offline/mydomain> unassign("AppDeployment", "myAppDeployment", "Target", "newServer") 
wls:/offline/mydomain> assign('AppDeployment.SubDeployment.SubDeployment', 'MedRecEAR.MedRecAppScopedJMS.MedRecJMSServer', 'Target','AdminServer')

undo

* Reverts all unsaved or unactivated edits.
– Does not release the edit session.
* Online or offline
* Syntax:

undo([unactivatedChanges], [defaultAnswer])

– unactivatedChanges: defaults to false.
– defaultAnswer: defaults to null.
* Example:

wls:/basicWLSDomain/edit !> undo()
Sure you would like to undo your changes? (y/n)y
Discarded your in-memory changes successfully.
wls:/basicWLSDomain/edit !> undo('true')
Sure you would like to undo your changes? (y/n)y
Discarded all your changes successfully.
wls:/basicWLSDomain/edit !>

validate

* Validates the changes that have been made but have not yet been saved.
– This command enables you to verify that all changes are valid before saving them.
* Online
* Syntax:

validate()

* Example:

wls:/basicWLSDomain/edit !> validate()
Validating changes ...
Validated the changes successfully
wls:/basicWLSDomain/edit !>

References

* WLST Command and Variable Reference

This entry was posted in weblogic11g and tagged . Bookmark the permalink.

2 Responses to WLST: Command and Variable Reference

  1. Pingback: WLST Command Reference for WebLogic Server | Wanderer

Leave a Reply

Your email address will not be published. Required fields are marked *


*

This site uses Akismet to reduce spam. Learn how your comment data is processed.