WebLogic Scripting Tool

     Previous  Next    Open TOC in new window  Open Index in new window  View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

WLST Command and Variable Reference

The following sections describe the WLST commands and variables in detail. Topics include:

 


Overview of WSLT Command Categories

Note: It is recommended that you review Requirements for Entering WLST Commands for command syntax requirements.

WLST commands are divided into the following categories.

Table A-1 WLST Command Categories 
Command Category
Description
Navigate the hierarchy of configuration or runtime beans and control the prompt display.
  • Connect to or disconnect from a server.
  • Create and configure a WebLogic domain or domain template.
  • Exit WLST.
  • 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.
Export diagnostic data.
Interrogate and edit configuration beans.
Interrogate domains, servers, and variables, and provide configuration bean, runtime bean, and WLST-related information.
Manage the life cycle of a server instance.
Start, shut down, restart, and monitor WebLogic Server instances using Node Manager.
Navigate among MBean hierarchies.

 


Browse Commands

Use the WLST browse commands, listed in Table A-2, to navigate the hierarchy of configuration or runtime beans and control the prompt display.

Table A-2 Browse Commands for WLST Configuration 
Use this command...
To...
Use with WLST...
Navigate the hierarchy of configuration or runtime beans.
Online or Offline
Return the current location in the hierarchy.
Online
Toggle the display of path information at the prompt.
Online or Offline
Display the current location in the hierarchy.
Online or Offline

cd

Command Category: Browse Commands
Use with WLST: Online or Offline

Description

Navigates the hierarchy of configuration or runtime beans. This command uses a model that is similar to navigating a file system in a Windows or UNIX command shell. For example, to navigate back to a parent configuration or runtime bean, enter cd('..'). The character string.. (dot-dot), refers to the directory immediately above the current directory. To get back to the root bean after navigating to a bean that is deep in the hierarchy, enter cd('/').

You can navigate to beans in the current hierarchy and to any child or instance.

The cd command returns a stub of the configuration or runtime bean instance, if one exists. If you navigate to a type, this command returns a stub of the configuration or runtime bean instance from which you navigated. In the event of an error, the command returns a WLSTException.

Note: The cmo variable is initialized to the root of all domain configuration beans when you first connect WLST to a server instance. It reflects the parent configuration bean type until you navigate to an instance. For more information about the cmo variable, see Changing the Current Management Object.

Syntax

cd(mbeanName)

Argument
Definition 
mbeanName
Path to the bean in the namespace.

Examples

The following example navigates the hierarchy of configuration beans. The first command navigates to the Servers configuration bean type, the second, to the myserver configuration bean instance, and the last back up two levels to the original directory location.

wls:/mydomain/serverConfig> cd('Servers')
wls:/mydomain/serverConfig/Servers> cd('myserver')
wls:/mydomain/serverConfig/Servers/myserver> cd('../..')
wls:/mydomain/serverConfig>

currentTree

Command Category: Browse Commands
Use with WLST: Online

Description

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.

Syntax

currentTree()

Example

The following example stores the current location in the hierarchy in myTree and uses it to navigate back to the Edit MBean hierarchy from the runtime MBean hierarchy on an Administration Server instance.

wls:/mydomain/edit> myTree=currentTree()
wls:/mydomain/edit> serverRuntime()
Location changed to serverRuntime tree. This is a read-only tree with
ServerRuntimeMBean as the root.
For more help, use help('serverRuntime')

wls:/mydomain/serverRuntime> myTree()
wls:/mydomain/edit>

prompt

Command Category: Browse Commands
Use with WLST: Online or Offline

Description

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.

You can also explicitly specify on or off as an argument to the command. When you specify off, WLST hides the WLST prompt and defaults to the Jython prompt. By default, the WLST prompt displays the configuration or runtime navigation path information.

When you disable the prompt details, to determine your current location in the hierarchy, you can use the pwd command, as described in pwd.

In the event of an error, the command returns a WLSTException.

Syntax

prompt(myPrompt)

Argument
Definition 
myPrompt
Optional. Hides or displays WLST prompt. Valid values include off or on.
  • The off argument hides the WLST prompt.
  • If you run prompt('off'), when using WLST online, the prompt defaults to the Jython prompt. You can create a new prompt using Jython syntax. For more information about programming using Jython, see http://www.jython.org. In this case, if you subsequently enter the prompt command without arguments, WLST displays the WLST command prompt without the path information. To redisplay the path information, enter prompt() again, or enter prompt('on').

  • The on argument displays the default WLST prompt, including the path information.

Examples

The following example hides and then redisplays the path information at the prompt.

wls:/mydomain/serverConfig/Servers/myserver> prompt()
wls:/> prompt()
wls:/mydomain/serverConfig/Servers/myserver>

The following example hides the prompt and defaults to the Jython prompt (since the command is run using WLST online), changes the Jython prompt, and then redisplays the WLST prompt. This example also demonstrates the use of the pwd command.

Note: For more information about programming using Jython, see http://www.jython.org.
wls:/mydomain/serverConfig/Servers/myserver> prompt('off')
>>>sys.ps1="myprompt>"
myprompt> prompt()
wls:> pwd()
‘serverConfig:Servers/myserver’
wls:> prompt()
wls:/mydomain/serverConfig/Servers/myserver>

pwd

Command Category: Browse Commands
Use with WLST: Online or Offline

Description

Displays the current location in the configuration or runtime bean hierarchy.

This command is useful when you have turned off the prompt display of the path information using the prompt command, as described in prompt.

In the event of an error, the command returns a WLSTException.

Syntax

pwd()

Example

The following example displays the current location in the configuration bean hierarchy.

wls:/mydomain/serverConfig/Servers/myserver/Log/myserver> pwd()
'serverConfig:/Servers/myserver/Log/myserver'

 


Control Commands

Use the WLST control commands, listed in Table A-3, to perform the following tasks:

Table A-3 lists the control commands for WLST configuration.

Table A-3 Control Commands for WLST Configuration 
In order to...
Use this command...
To...
Use with WLST...
Connect to and disconnect from a WebLogic Server instance
Connect WLST to a WebLogic Server instance.
Online or Offline
Disconnect WLST from a WebLogic Server instance.
Online
Create a new domain from a domain template
Create a new domain using the specified template.
Offline
Open an existing domain template for domain creation.
Offline
Write the domain configuration information to the specified directory.
Offline
Close the current domain template.
Offline
Update an existing domain (offline)
Open an existing domain for updating.
Offline
Extend the current domain using an application or service extension template.
Offline
Update and save the current domain.
Offline
Close the current domain.
Offline
Write a domain template
Writes the configuration information to the specified domain template file.
Offline
Exit WLST
Exit WLST from the interactive session and close the scripting shell.
Online or Offline

addTemplate

Command Category: Control Commands
Use with WLST: Offline

Description

Extends the current domain using an application or service extension template. In the event of an error, the command returns a WLSTException.

Syntax

addTemplate(templateFileName)

Argument
Definition 
templateFileName
Name of the application or service extension template.

Example

The following example opens a domain and extends it using the specified extension template, DefaultWebApp.jar.

wls:/offline> readDomain('c:/bea/user_projects/domains/wlw')
wls:/offline/wlw> addTemplate('c:/bea/weblogic92/common/templates/
applications/DefaultWebApp.jar')
wls:/offline/wlw>

closeDomain

Command Category: Control Commands
Use with WLST: Offline

Description

Closes the current domain. The domain is no longer available for editing once it is closed. In the event of an error, the command returns a WLSTException.

Syntax

closeDomain()

Example

The following example closes the current domain:

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

closeTemplate

Command Category: Control Commands
Use with WLST: Offline

Description

Closes the current domain template. The domain template is no longer available once it is closed. In the event of an error, the command returns a WLSTException.

Syntax

closeTemplate()

Example

The following example opens an existing domain template, performs some operations, and then closes the current domain template.

wls:/offline> readTemplate('c:/bea/weblogic81/common/templates/domains/
wls.jar')
...
wls:/offline/wls> closeTemplate()
wls:/offline>

connect

Command Category: Control Commands
Use with WLST: Online or Offline

Description

Connects WLST to a WebLogic Server instance.

You can specify the username and password on the command line, or you can specify an encrypted password that is stored locally by specifying the locations of the user configuration and key files as arguments to the connect command. For information about creating the user configuration and key files, see storeUserConfig.

Online, if you encrypt the password and later use the ls() command after connect(), asterisk (*) is displayed for encrypted attributes instead of as clear text. For compatibility reasons, both a clear text and encrypted attribute are available and are displayed. For example, an ls() in the EmbeddedLDAP MBean displays the following:

-rw-   Credential             ******
-rw-   CredentialEncrypted    ******

If you run the connect command without specifying the username and password, WLST attempts to process the command using one of the methods listed below (in order of precedence):

  1. WLST searches for the default user configuration and key files that contain an encrypted username and password. This information must be valid for your current domain.
  2. If the connect command was run from the domain directory in which the server was started, WLST attempts to load the username and password from the boot.properties file.
  3. WLST prompts for a username, password, and URL.

If you do not specify the Administration Server name, the argument defaults to AdminServer.

Please note:

After successfully connecting to a WebLogic Server instance, all the local variables are initialized.

In the event of an error, the command returns a WLSTException.

Syntax

connect([username, password], [url], [adminServerName])

connect([userConfigFile, userKeyFile], [adminServerName])

Argument
Definition 
username
Optional. Username of the operator who is connecting WLST to the server. If not specified, WLST processes the command as described above.
password
Optional. Password of the operator who is connecting WLST to the server. If not specified, WLST processes the command as described above.
url
Optional. Listen address and listen port of the server instance, specified using the following format: [protocol://]listen-address:listen-port. If not specified, this argument defaults to t3://localhost:7001.
userConfigFile
Optional. Name and location of a user configuration file which contains an encrypted username and password.
When you create a user configuration file, the storeUserConfig command uses a key file to encrypt the username and password. Only the key file that encrypts a user configuration file can decrypt the username and password. (See storeUserConfig.)
userKeyFile
Optional. Name and location of the key file that is associated with the specified user configuration file and is used to decrypt it. (See storeUserConfig.)
adminServerName
Optional. Name of the Administration Server. This value is used when WLST is invoked from a domain directory. This argument defaults to AdminServer.

Examples

The following example connects WLST to a WebLogic Server instance. In this example, the Administration Server name defaults to AdminServer. Note that a warning is displayed if the SSL or administration port is not used to connect to the server.

wls:/offline> connect('weblogic','weblogic','t3://localhost:8001')
Connecting to weblogic server instance running at t3://localhost:8001 as username weblogic...

Successfully connected to Admin Server 'AdminServer' that belongs to domain
'mydomain'.

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:/mydomain/serverConfig>

The following example connects WLST to a WebLogic Server instance at the specified URL. In this example, the username and password are passed as variables. This example uses a secure protocol.

wls:/offline> username = 'weblogic'
wls:/offline> password = 'weblogic'
wls:/offline> connect(username,password,'t3s://myhost:8001')
Connecting to weblogic server instance running at t3://myhost:8001 as
username weblogic...

Successfully connected to Admin Server 'AdminServer' that belongs to domain
'mydomain'.
wls:/mydomain/serverConfig>

The following example connects WLST to a WebLogic Server instance using a user configuration and key file to provide user credentials. The Administration Server name defaults to AdminServer.

wls:/offline> connect(userConfigFile='c:/myfiles/myuserconfigfile.secure', userKeyFile='c:/myfiles/myuserkeyfile.secure')
Connecting to weblogic server instance running at t3://localhost:7001 as
username ...

Successfully connected to Admin Server 'AdminServer' that belongs to domain 'mydomain'.
wls:/mydomain/serverConfig>

createDomain

Command Category: Control Commands
Use with WLST: Offline

Description

Creates a domain using the specified template.

Note: If you wish to modify the domain configuration settings when creating a domain, see Option 2 in Creating a Domain (Offline).
Note: The createDomain command is similar in functionality to the unpack command, as described in Creating Templates and Domains Using the pack and unpack Commands.

In the event of an error, the command returns a WLSTException.

Syntax

createDomain(domainTemplate, domainDir, user, password)

Argument
Definition 
domainTemplate
Name and location of the domain template from which you want to create a domain.
domainDir
Name of the directory to which you want to write the domain configuration information.
user
Name of the default user.
password
Password of the default user.

Example

The following example creates a new domain using the Avitek MedRec template and sets the default username and password to weblogic. The domain is saved to the following directory: c:/bea/user_projects/domains/medrec.

wls:/offline> createDomain('c:/bea/weblogic92/common/templates/domains
/wls_medrec.jar','c:/bea/user_projects/domains/medrec', 'weblogic', 'weblogic')

disconnect

Command Category: Control Commands
Use with WLST: Online

Description

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.

In the event of an error, the command returns a WLSTException.

You can connect to another WebLogic Server instance using the connect command, as described in connect.

Syntax

disconnect(force)

Argument
Definition 
force
Optional. Boolean value specifying whether WLST should disconnect without waiting for the active sessions to complete. This argument defaults to false, indicating that all active sessions must complete before disconnect.

Example

The following example disconnects from a running server:

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

exit

Command Category: Control Commands
Use with WLST: Online or Offline

Description

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.

By default, WLST calls System.exit(0) for the current WLST JVM when exiting WLST. If you would like the JVM to exit with a different exit code, you can specify a value using the exitCode argument.

Note: When the WLST exit command is issued within an Ant script, it may also exit the execution of the Ant script. It is recommended that when invoking WLST within an Ant script, you fork a new JVM by specifying fork="true".

In the event of an error, the command returns a WLSTException.

Syntax

exit([defaultAnswer], [exitcode])

Argument
Definition 
defaultAnswer
Optional. Default response, if you would prefer not to be prompted at the command line. Valid values are y and n. This argument defaults to null, and WLST prompts you for a response.
exitcode
Optional. Exit code to set when exiting WLST.

Example

The following example disconnects from the user session and closes the scripting shell.

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

The following example disconnects from the user session, closes the scripting shell, and sets the error code to 101.

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

readDomain

Command Category: Control Commands
Use with WLST: Offline

Description

Opens an existing domain for updating.

When you open a template or domain, WLST is placed into the configuration bean hierarchy for that domain, and the prompt is updated to reflect the current location in the configuration hierarchy. For example:

wls:/offline/base_domain>

WebLogic Server configuration beans exist within a hierarchical structure. In the WLST file system, the hierarchies correspond to drives; types and instances are directories; attributes and operations are files. WLST traverses the hierarchical structure of configuration beans using commands such as cd, ls, and pwd in a similar way that you would navigate a file system in a UNIX or Windows command shell. After navigating to an configuration bean instance, you interact with the bean using WLST commands. For more information, see Navigating and Interrogating MBeans.

Offline, if you encrypt the password and later use the ls() command after readDomain(), only the encrypted form and the encrypted value are printed. For example,

-rw-   CredentialEncrypted      {3DES}nvZus88Ttco

In the event of an error, the command returns a WLSTException.

Syntax

readDomain(domainDirName)

Argument
Definition 
domainDirName
Name of the domain directory that you wish to open.

Example

The following example opens the medrec domain for editing.

wls:/offline> readDomain('c:/bea/user_projects/domains/medrec')
wls:/offline/medrec>

readTemplate

Command Category: Control Commands
Use with WLST: Offline

Description

Opens an existing domain template for domain creation.

When you open a domain template, WLST is placed into the configuration bean hierarchy for that domain template, and the prompt is updated to reflect the current location in the configuration hierarchy. For example:

wls:/offline/base_domain>

WebLogic Server configuration beans exist within a hierarchical structure. In the WLST file system, the hierarchies correspond to drives; types and instances are directories; attributes and operations are files. WLST traverses the hierarchical structure of configuration beans using commands such as cd, ls, and pwd in a similar way that you would navigate a file system in a UNIX or Windows command shell. After navigating to a configuration bean instance, you interact with the bean using WLST commands. For more information, see Navigating and Interrogating MBeans.

Note: Using WLST and a domain template, you can only create and access security information when you are creating a new domain. When you are updating a domain, you cannot access security information through WLST.

In the event of an error, the command returns a WLSTException.

Syntax

readTemplate(templateFileName)

Argument
Definition 
templateFileName
Name of the JAR file corresponding to the domain template.

Example

The following example opens the medrec.jar domain template for domain creation.

wls:/offline> readTemplate('c:/bea/weblogic92/common/templates/domains
/wls_medrec.jar')
wls:/offline/wls_medrec>

updateDomain

Command Category: Control Commands
Use with WLST: Offline

Description

Updates and saves the current domain. The domain continues to be editable after you update and save it.

In the event of an error, the command returns a WLSTException.

Syntax

updateDomain()

Example

The following examples opens the medrec domain, performs some operations, and updates and saves the current domain:

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

writeDomain

Command Category: Control Commands
Use with WLST: Offline

Description

Writes the domain configuration information to the specified directory.

Once you write the 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 domain, the associated applications are written to BEAHOME/user_projects/applications/domainname, where BEAHOME specifies the BEA home directory and domainname specifies the name of the domain. This directory must be empty; otherwise, WLST displays an error.

When you have finished using the domain template object in memory, close it using the closeTemplate command. If you want to edit the domain that has been saved to disk, you can open it using the readDomain command.

Note: The name of the domain is derived from the name of the domain directory. For example, for a domain saved to c:/bea/user_projects/domains/myMedrec, the domain name is myMedrec.

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('weblogic')

In the event of an error, the command returns a WLSTException.

Syntax

writeDomain(domainDir)

Argument
Definition 
domainDir
Name of the directory to which you want to write the domain configuration information.

Example

The following example reads the medrec.jar domain templates, performs some operations, and writes the domain configuration information to the c:/bea/user_projects/domains/medrec directory.

wls:/offline> readTemplate('c:/bea/weblogic81/common/templates/domains
/wls.jar')
...
wls:/offline/base_domain> writeDomain('c:/bea/user_projects/domains/base_domain')

writeTemplate

Command Category: Control Commands
Use with WLST: Offline

Description

Writes the domain configuration information to the specified domain template. You can use the domain configuration template to recreate the domain.

Once your write the configuration information to the domain configuration template, you can continue to update the domain or domain template object that exists in memory, and reissue the writeDomain or writeTemplate command to store the domain configuration to a new or existing domain or domain template file. For more information, see writeDomain or writeTemplate, respectively.

In the event of an error, the command returns a WLSTException.

Note: The writeTemplate command is similar in functionality to the pack command, as described in Creating Templates and Domains Using the pack and unpack Commands. However, writeTemplate does not support creating a Managed Server template.

Syntax

writeTemplate(templateName)

Argument
Definition 
templateName
Name of the domain template to store the domain configuration information.

Example

The following example writes the current domain configuration to the domain template named c:/bea/user_projects/templates/myTemplate.jar.

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

 


Deployment Commands

Use the WLST deployment commands, listed in Table A-4, to:

For more information about deploying applications, see Deploying Applications to WebLogic Server.

Table A-4 Deployment Commands for WLST Configuration 
This command...
Enables you to...
Use with WLST...
Deploy an application to a WebLogic Server instance.
Online
Copy the deployment bundle to the specified targets.
Online
Return the WebLogic DeploymentManager object.
Online
Load an application and deployment plan into memory.
Online
Redeploy a previously deployed application
Online
Start an application, making it available to users.
Online
Stop an application, making it unavailable to users.
Online
Undeploy an application from the specified servers.
Online
Updates an application configuration using a new deployment plan.
Online

deploy

Command Category: Deployment Commands
Use with WLST: Online

Description

Deploys an application to a WebLogic Server instance.

The deploy command returns a WLSTProgress object that you can access to check the status of the command. For more information about the WLSTProgress object, see WLSTProgress Object. In the event of an error, the command returns a WLSTException.

Note: If there is an edit session in progress, the deploy command does not block user interaction.

Syntax

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

Argument
Definition 
appName
Name of the application or standalone J2EE module to be deployed.
path
Name of the application directory, archive file, or root of the exploded archive directory to be deployed.
targets
Optional. Comma-separated list of the target. Each target may be qualified with a J2EE module name (for example, module1@server1) enabling you to deploy different modules of the application archive on different servers. This argument defaults to the server to which WLST is currently connected.
stageMode
Optional. Staging mode for the application you are deploying. Valid values are stage, nostage, and external_stage. For information about the staging modes, see “Controlling Deployment File Copying with Staging Modes” in Deploying Applications to WebLogic Server. This argument defaults to null.
planPath
Optional. 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
Optional. Comma-separated list of deployment options, specified as name-value pairs. Valid options include:
  • altDD—Location of the alternate application deployment descriptor on the Administration Server.
  • altWlsDD—Location of the alternate WebLogic application deployment descriptor on the Administration Server.
  • archiveVersion—Archive version number.
  • block—Boolean value specifying whether WLST should block user interaction until the command completes. This option defaults to true. If set to false, WLST returns control to the user after issuing the command; you can query the WLSTProgress object to determine the status of the command. If you are importing WLST as a Jython module, as described in Importing WLST as a Jython Module, block is always set to true.
  • clusterDeploymentTimeout—Time, in milliseconds, granted for a cluster deployment task on this application.
  • createPlan—Boolean value indicating that user would like to create a default plan. This option defaults to false.
options (Continued)
  • defaultSubmoduleTargets—Boolean value indicating that targeting for qualifying JMS submodules should be derived by the system, see Using Sub-Module Targeting with JMS Application Modules in Deploying Applications to WebLogic Server. Default value is true.
  • forceUndeployTimeout—Force undeployment timeout value.
  • gracefulIgnoreSessions—Boolean value specifying whether the graceful production to admin mode operation should ignore pending HTTP sessions. This option defaults to false and only applies if gracefulProductionToAdmin is set to true.
  • gracefulProductionToAdmin—Boolean value specifying whether the production to Admin mode operation should be graceful. This option defaults to false.
  • libImplVersion—Implementation version of the library, if it is not present in the manifest.
  • libraryModule—Boolean value specifying whether the module is a library module. This option defaults to false.
  • libSpecVersion—Specification version of the library, if it is not present in the manifest.
  • planVersion—Plan version number.
  • retireGracefully—Retirement policy to gracefully retire an application only after it has completed all in-flight work. This policy is only meaningful for stop and redeploy operations and is mutually exclusive to the retire timeout policy.
  • retireTimeout—Time (in seconds) WLST waits before retiring an application that has been replaced with a newer version. This option default to -1, which specifies graceful timeout.
  • securityModel—Security model. Valid values include: DDOnly, CustomRoles, CustomRolesAndPolicies, and Advanced.
  • securityValidationEnabled—Boolean value specifying whether security validation is enabled.
  • subModuleTargets—Submodule level targets for JMS modules. For example, submod@mod-jms.xml@target | submoduleName@target.
  • testMode—Boolean value specifying whether to start the Web application with restricted access. This option defaults to false.
  • timeout—Time (in milliseconds) that WLST waits for the deployment process to complete before canceling the operation. A value of 0 indicates that the operation will not time out. This argument defaults to 300,000 ms (or 5 minutes).
  • versionIdentifier—Version identifier.
Upload
Optional. Boolean value specifying whether the application files are uploaded to the WebLogic Server Administration Server'’s upload directory prior to deployment. Use this option when you are on a different machine from the Administration Server and you cannot copy the deployment files by other means. This option defaults to false.

Example

The following example deploys the businessApp application located at c:/myapps/business, A default deployment plan is created.

The deploy command returns a WLSTProgress object that you can access to check the status of the command. The WLSTProgress object is captured in a user-defined variable, in this case, progress.

wls:/mydomain/serverConfig/Servers> progress= deploy(appName='businessApp',path='c:/myapps/business',createplan='true')

The previous example stores the WLSTProgress object returned in a user-defined variable, in this case, progress. You can then use the progress variable to print the status of the deploy command. For example:

wls:/mydomain/serverConfig/Servers> progress.printStatus()
Current Status of your Deployment:
Deployment command type: deploy
Deployment State : completed
Deployment Message : null
wls:/mydomain/serverConfig/Servers>

For more information about the WLSTProgress object, see WLSTProgress Object.

The following example deploys the demoApp application in the archive file located at c:/myapps/demos/app/demoApp.ear, targeting the application modules to myserver, and using the deployment plan file located in c:/myapps/demos/app/plan/plan.xml. WLST waits 120,000 ms for the process to complete.

wls:/mydomain/serverConfig/Servers> deploy('demoApp', 'c:/myapps/demos/app/demoApp.ear', targets='myserver', planPath='c:/myapps/demos/app/plan/plan.xml', timeout=120000)

The following example deploys the jmsApp application located at c:/myapps/demos/jmsApp/demo-jms.xml, targeting the application module to a specific target.

wls:/mydomain/serverConfig/Servers>deploy('jmsApp',path='c:/myapps/demos/jmsApps/demo-jms.xml', subModuleTargets='jmsApp@managed1')

The following example shows how to set the application version (appVersion) to a unique identifier to support production (side-by-side) redeployment. This example deploys the demoApp application in the archive file located at c:/myapps/demos/app/demoApp.ear, and sets the application and archive version numbers to the specified values.

wls:/mydomain/serverConfig> deploy('demoApp', 'c:/myapps/demos/app/demoApp.ear', archiveVersion='901-101', appVersion='901-102')

For more information about production redeployment strategies, see “Updating Applications in a Production Environment” in Deploying Applications to WebLogic Server.

distributeApplication

Command Category: Deployment Commands
Use with WLST: Online

Description

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.

The distributeApplication command returns a WLSTProgress object that you can access to check the status of the command. For more information about the WLSTProgress object, see WLSTProgress Object. In the event of an error, the command returns a WLSTException.

Syntax

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

Argument
Definition 
appPath
Name of the archive file or root of the exploded archive directory to be deployed.
planPath
Optional. 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.
targets
Optional. Comma-separated list of targets. Each target may be qualified with a J2EE module name (for example, module1@server1) enabling you to deploy different modules of the application archive on different servers. This argument defaults to the server to which WLST is currently connected.
options
Optional. Comma-separated list of deployment options, specified as name-value pairs. For a list of valid deployment options, see the options argument description in deploy.

Example

The following example loads the BigApp application located in the c:/myapps directory, and stores the WLSTProgress object in a user-defined variable, in this case, progress.

The following example distributes the c:/myapps/BigApp application to the myserver, oamserver1, and oamcluster servers, using the deployment plan defined at c:/deployment/BigApp/plan.xml.

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

The previous example stores the WLSTProgress object in a user-defined variable, in this case, progress. You can then use the progress variable to determine if the distributeApplication command has completed. For example:

wls:/mydomain/serverConfig/Servers> progress.isCompleted()
1
wls:/mydomain/serverConfig/Servers>

For more information about the WLSTProgress object, see WLSTProgress Object.

getWLDM

Command Category: Deployment Commands
Use with WLST: Online

Description

Returns the WebLogic DeploymentManager object. You can use the object methods to configure and deploy applications. WLST must be connected to an Administration Server to run this command. In the event of an error, the command returns a WLSTException.

Syntax

getWLDM()

Example

The following example gets the WebLogicDeploymentManager object and stores it in the wldm variable.

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

loadApplication

Command Category: Deployment Commands
Use with WLST: Online

Description

Loads an application and deployment plan into memory.

The loadApplication command returns a WLSTPlan object that you can access to make changes to the deployment plan. For more information about the WLSTPlan object, see WLSTPlan Object. In the event of an error, the command returns a WLSTException.

Syntax

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

Argument
Definition 
appPath
Name of the top-level parent application directory, archive file, or root of the exploded archive directory containing the application to be loaded.
planPath
Optional. 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.
createPlan
Optional. Boolean value specifying whether WLST should create a plan in the application directory if the specified plan does not exist. This argument defaults to true.

Example

The following example loads the c:/myapps/myejb.jar application using the plan file at c:/myplans/myejb/plan.xml.

wls:/myserver/serverConfig> myPlan=loadApplication('c:/myapps/myejb.jar', 'c:/myplans/myejb/plan.xml')
Loading application from c:/myapps/myejb.jar and deployment plan from c:/myplans/myejb/plan.xml ...
Successfully loaded the application.
wls:/myserver/serverConfig>

The previous example stores the WLSTPlan object returned in the myPlan variable. You can then use myPlan variable to display information about the plan, such as the variables. For example:

wls:/myserver/serverConfig> myPlan.showVariables()
MyEJB jndi.ejb
MyWAR app.foo
wls:/myserver/serverConfig>

For more information about the WLSTPlan object, see WLSTPlan Object.

redeploy

Command Category: Deployment Commands
Use with WLST: Online

Description

Reloads classes and redeploys a previously deployed application.

The redeploy command returns a WLSTProgress object that you can access to check the status of the command. For more information about the WLSTProgress object, see WLSTProgress Object.

In the event of an error, the command returns a WLSTException.

For more information about redeploying applications, see “Overview of Common Deployment Scenarios” in Deploying Application to WebLogic Server.

Syntax

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

Argument
Definition 
appName
Name of the application to be redeployed.
planPath
Optional. 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
Optional. Comma-separated list of deployment options, specified as name-value pairs. For a list of valid deployment options, see options argument description in deploy.
In addition, the following deployment option can be specified for the redeploy command:
  • appPath—Name of the archive file or root of the exploded archive directory to be redeployed.

Example

The following example redeploys myApp application using the plan.xml file located in the c:/myapps directory.

wls:/mydomain/serverConfig> progress=redeploy('myApp' 'c:/myapps/plan.xml')
Redeploying application 'myApp' ...
Redeployment of 'myApp' is successful
wls:/mydomain/serverConfig>

The previous example stores the WLSTProgress object returned in a user-defined variable, in this case, progress. You can then use the progress variable to access the state of the redeploy command. For example:

wls:/mydomain/serverConfig/Servers> progress.getState()
‘completed’
wls:/mydomain/serverConfig/Servers>

For more information about the WLSTProgress object, see WLSTProgress Object.

startApplication

Command Category: Deployment Commands
Use with WLST: Online

Description

Starts an application, making it available to users. The application must be fully configured and available in the domain.

The startApplication command returns a WLSTProgress object that you can access to check the status of the command. For more information about the WLSTProgress object, see WLSTProgress Object. In the event of an error, the command returns a WLSTException.

Syntax

startApplication(appName, [options])

Argument
Definition 
appName
Name of the application to start, as specified in the plan.xml file.
options
Optional. Comma-separated list of deployment options, specified as name-value pairs. For a list of valid deployment options, see options argument description in deploy.

Example

The following example starts the BigApp application with the specified deployment options.

wls:/offline> progress=startApplication('BigApp', stageMode='NOSTAGE', testMode='false')
Starting the application...
Successfully started the application.

The previous example stores the WLSTProgress object returned in a user-defined variable, in this case, progress. You can then use the progress variable to access the state of the startApplication command. For example:

wls:/mydomain/serverConfig/Servers> progress.getState()
‘completed’
wls:/mydomain/serverConfig/Servers>

For more information about the WLSTProgress object, see WLSTProgress Object.

stopApplication

Command Category: Deployment Commands
Use with WLST: Online

Description

Stops an application, making it unavailable to users. The application must be fully configured and available in the domain.

The stopApplication command returns a WLSTProgress object that you can access to check the status of the command. For more information about the WLSTProgress object, see WLSTProgress Object.

In the event of an error, the command returns a WLSTException.

Syntax

stopApplication(appName, [options])

Argument
Definition 
appName
Name of the application to stop, as specified in the plan.xml file.
options
Optional. Comma-separated list of deployment options, specified as name-value pairs. For a list of valid deployment options, see options argument description in deploy.

Example

The following example stops the BigApp application.

wls:/offline> progress=stopApplication('BigApp')
Stopping the application...
Successfully stopped the application.

The previous example stores the WLSTProgress object returned in a user-defined variable, in this case, progress. You can then use the progress variable to check whether stopApplication command is running. For example:

wls:/mydomain/serverConfig/Servers> progress.isRunning()
0
wls:/mydomain/serverConfig/Servers>

For more information about the WLSTProgress object, see WLSTProgress Object.

undeploy

Command Category: Deployment Commands
Use with WLST: Online

Description

Undeploys an application from the specified servers.

The undeploy command returns a WLSTProgress object that you can access to check the status of the command. For more information about the WLSTProgress object, see WLSTProgress Object. In the event of an error, the command returns a WLSTException.

For more information about deploying and undeploying applications, see “Overview of Common Deployment Scenarios” in Deploying Applications to WebLogic Server.

Syntax

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

Argument
Definition 
appName
Deployment name for the deployed application.
targets
Optional. List of the target servers from which the application will be removed. If not specified, defaults to all current targets.
options
Optional. Comma-separated list of deployment options, specified as name-value pairs. For a list of valid deployment options, see options argument description in deploy.

Example

The following example removes the businessApp application from all target servers. WLST waits 60,000 ms for the process to complete.

wls:/mydomain/serverConfig> undeploy('businessApp', timeout=60000)
Undeploying application businessApp ...
<Jul 20, 2005 9:34:15 AM EDT> <Info> <J2EE Deployment SPI> <BEA-260121>
<Initiating undeploy operation for application, businessApp [archive: null],
to AdminServer .>
Completed the undeployment of Application with status
Current Status of your Deployment:
Deployment command type: undeploy
Deployment State : completed
Deployment Message : no message
wls:/mydomain/serverConfig>

updateApplication

Command Category: Deployment Commands
Use with WLST: Online

Description

Updates an application configuration using a new deployment plan. The application must be fully configured and available in the domain.

The updateApplication command returns a WLSTProgress object that you can access to check the status of the command. For more information about the WLSTProgress object, see WLSTProgress Object. In the event of an error, the command returns a WLSTException.

Syntax

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

Argument
Definition 
appName
Name of the application, as specified in the current plan.xml file.
planPath
Optional. Name of the new deployment plan file. The filename can be absolute or relative to the application directory.
options
Optional. Comma-separated list of deployment options, specified as name-value pairs. For a list of valid deployment options, see options argument description in deploy.

Example

The following example updates the application configuration for BigApp using the plan.xml file located in c:/myapps/BigApp/newPlan.

wls:/offline> progress=updateApplication('BigApp', 'c:/myapps/BigApp/newPlan/plan.xml', stageMode='STAGE', testMode='false')
Updating the application...
Successfully updated the application.

The previous example stores the WLSTProgress object returned in a user-defined variable, in this case, progress. You can then use the progress variable to access the state of the updateApplication command. For example:

wls:/mydomain/serverConfig/Servers> progress.getState()
‘completed’
wls:/mydomain/serverConfig/Servers>

For more information about the WLSTProgress object, see WLSTProgress Object.

 


Diagnostics Commands

Use the WLST diagnostics commands, listed in Table A-5, to execute queries against the diagnostic data. For more information about the WebLogic Server Diagnostic Service, see Configuring and Using the WebLogic Diagnostic Framework.

Table A-5 Diagnostic Command for WLST Configuration 
This command...
Enables you to...
Use with WLST...
Execute a query against the specified log file.
Offline
Executes a query on the server side and retrieves the exported WebLogic Diagnostic Framework (WLDF) data.
Online

exportDiagnosticData

Command Category: Diagnostics Commands
Use with WLST: Offline

Description

Executes a query against the specified log file. The results are saved to an XML file.

For more information about the WebLogic Server Diagnostic Service, see Configuring and Using the WebLogic Diagnostic Framework.

In the event of an error, the command returns a WLSTException.

Syntax

exportDiagnosticData([options])

Argument
Definition 
options
Optional. Comma-separated list of export diagnostic options, specified as name-value pairs. Valid options include:
  • 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.