![]() ![]() ![]() ![]() ![]() ![]() |
This document describes how to use the BEA Products™ Scripting Tool (WLST) for offline configuration. Topics include:
WLST is a command-line scripting interface that you use to configure WebLogic Server and WebLogic domains. Using WLST, WebLogic Server administrators and operators can perform administrative tasks and initiate WebLogic Server configuration changes interactively or by using an executable script.
Note: | The WLST scripting environment is based on the Java scripting interpreter, Jython. For more information about the Jython language syntax, see
http://www.jython.org . |
WLST supports both online and offline configuration:
Enables you to perform administrative tasks and initiate WebLogic Server configuration changes while connected to a running server. For more information about WLST online configuration, see WebLogic Server Scripting Language, delivered with the WLST online configuration kit, WebLogic Scripting Tool (WLST) for 7.0 & 8.1 (Artifact ID S13), in the dev2dev code samples project at:
https://codesamples.projects.dev2dev.bea.com/servlets/Scarab?id=13
Enables you to create a new domain or update an existing domain without connecting to a running WebLogic Server—supporting the same functionality as the Configuration Wizard.
WLST offline configuration provides access to persisted configuration information. You can create new configuration information, and retrieve and change existing configuration values that are stored in the domain config.xml
file or in a domain template JAR created using Template Builder.
This document describes how to use WLST for offline configuration.
Refer to the following resources for additional information:
https://codesamples.projects.dev2dev.bea.com/servlets/Scarab?id=13
The following sections describe how to get started using WLST offline configuration. The following topics are described:
Note: | For information about getting started using WLST online configuration, see "Basic Steps for Using WLST" in WebLogic Server Scripting Language, delivered with the WLST online configuration kit, WebLogic Scripting Tool (WLST) for 7.0 & 8.1 (Artifact ID S13), in the dev2dev code samples project at: |
Note: |
https://codesamples.projects.dev2dev.bea.com/servlets/Scarab?id=13 |
For WebLogic Platform 8.1 SP5 (or a later release of 8.1), to set up your environment for WLST offline configuration, perform the following steps:
http://e-docs.bea.com/platform/docs81/install/index.html
Note: | To take full advantage of the domain and extension templates available, a full WebLogic Platform installation is recommended. At a minimum, you need to install the WebLogic Server 8.1 SP5 software, as described in the WebLogic Server and WebLogic Express Installation Guide at: |
Note: |
http://e-docs.bea.com/wls/docs81/install/index.html |
https://codesamples.projects.dev2dev.bea.com/servlets/Scarab?id=97
The WLST offline configuration kit contains the following files:
config.jar
, comdev.jar
, and 3rdparty.jar
) required to execute the WLST offline configuration tool.Note: | These files are included as part of the WebLogic Platform 8.1 SP5 (or later 8.1 release) software installation. They are not required to be extracted from the ZIP file. |
runWLSToffline.cmd
and runWLSToffline.sh
).README.txt
file summarizing the steps required to get started using the tool.wlst_offline.pdf
).CLASSPATH
environment variable to include the following WebLogic Server, Jython, and WLST files and directories:
WL_HOME
\server\lib
WL_HOME
\server\lib\weblogic.jar
WL_HOME
\common\lib\jython.jar
WL_HOME
\common\lib\config.jar
WL_HOME
\common\lib\comdev.jar
WL_HOME
\common\lib\3rdparty.jar
For WebLogic Platform 8.1 SP4, SP3, or SP2, to set up your environment for WLST offline configuration, perform the following steps:
http://e-docs.bea.com/platform/docs81/install/index.html
Note: | To take full advantage of the domain and extension templates available, a full WebLogic Platform installation is recommended. At a minimum, you need to install the WebLogic Server 8.1 SPx software, as described in the WebLogic Server and WebLogic Express Installation Guide at: |
Note: |
http://e-docs.bea.com/wls/docs81/install/index.html |
http://www.jython.org/download.html
.Note: | Download the WLST offline configuration kit (if you have not done so already), Configuring WebLogic Server with WLST Offline (Artifact ID S97), in the dev2dev code samples project at: |
Note: |
https://codesamples.projects.dev2dev.bea.com/servlets/Scarab?id=97 |
The WLST offline configuration kit contains the following files:
config.jar
, comdev.jar
, and 3rdparty.jar
) required to execute the WLST offline configuration tool.runWLSToffline.cmd
and runWLSToffline.sh
).README.txt
file summarizing the steps required to get started using the tool.wlst_offline.pdf
).CLASSPATH
environment variable to include the following WebLogic Server, Jython, and WLST files and directories:Note: | JYTHON_HOME refers to the root directory of your Jython installation. |
WL_HOME
\server\lib
WL_HOME
\server\lib\weblogic.jar
WL_HOME
\common\lib\config.jar
WL_HOME
\common\lib\comdev.jar
WL_HOME
\common\lib\3rdparty.jar
You can invoke WLST in interactive or script mode:
WLST interprets commands interactively, supplied one-at-a-time from a command prompt. Interactive mode enables you to:
WLST interprets commands from a script file. Script mode enables you to:
The methods for invoking WLST in each mode are described in the following sections. A summary of the sample scripts available is also provided in Summary of Sample Scripts.
To invoke WLST offline configuration in interactive mode, at a command prompt enter one of the following commands:
Windows: WL_HOME
\common\bin\runWLSToffline.cmd
Unix: WL_HOME
/common/bin/runWLSToffline.sh
WLST starts in interactive mode, and a welcome message and the WLST offline configuration prompt appears:
Welcome to Weblogic Scripting Shell
wls_offline:/>
Note: | The first time the command is run, the Jython package manager processes the JAR files in your CLASSPATH . |
You can begin entering commands, setting variables, or running a script to create a new or update an existing domain.
To run a WLST script in interactive mode, enter the execfile
command, as follows:
WLST_script
specifies the full pathname to the WLST script file. For a summary of the sample script files available, see Summary of Sample Scripts.
For more information about the WLST commands and variables, see WLST Offline Configuration Commands and WLST Offline Configuration Variables, respectively.
To invoke WLST offline configuration in script mode, at a command prompt enter one of the following commands:
Windows: WL_HOME
\common\bin\runWLSToffline.cmd
WLST_script
Unix: WL_HOME
/common/bin/runWLSToffline.sh
WLST_script
The WLST_script
argument specifies the full pathname to a WLST script file. For a summary of the sample script files available, see Summary of Sample Scripts.
WLST starts in script mode, executing the specified script without requiring your input.
Table 1 summarizes the WLST offline configuration sample scripts that you can run or use as templates for creating additional scripts.
Table 2 describes WLST offline configuration variables and their common usage. All variables are initialized to default values at the start of a user session and are changed according to the user interaction with WLST.
Note: | While in interactive mode, you can display help information for the WLST offline configuration variables using the help(`variables') command. For more information, see help. |
Specifies the Current Management Object. This variable is set to the configuration object to which you have navigated.
|
||
WLST offline configuration commands (primitives) are executable functions that are extensions to the Jython language and that follow the Jython syntax.
The following sections describe WLST offline configuration commands and how to use them. These commands are available when using WLST for offline configuration in interactive and script mode.
WLST offline configuration commands are divided into the following four categories:
The commands in each category are described in the following sections. Befor proceeding, it is recommended that you review Guidelines for Entering WLST Commands.
Please review the following guidelines for entering WLST commands:
`
newServer'
./
) as the delimiter on both Windows and Unix, according to the Jython sytnax. To specify a configuration object that includes a forward slash (/
) in its name, include the configuration object name in parentheses. For example:
cd(`JMSQueue/(jms/REGISTRATION_MDB_QUEUE)')
help()
command. For more information, see help.Similar to the Configuration Wizard, the control commands for WLST offline configuration enable you to perform the following tasks:
Table 3 lists the control commands for WLST offline configuration used to create a new or update an existing domain, or to exit WLST.
Each command is described in detail in the following sections. Commands are described alphabetically.
Extends the current domain using the specified application or service extension template.
addTemplate(templateFileName
)
The following command extends the current domain using the specified extension template:
wls_offline:/> readDomain(`c:/bea/user_projects/domains/wlw')
wls_offline:/wlw> addTemplate('c:/bea/weblogic81/common/templates/
applications/wlp.jar')
Closes the current domain. The domain is no longer available for editing once it is closed.
closeDomain()
The following command closes the current domain:
wls_offline:/> readDomain(`c:/bea/user_projects/domains/medrec')
...
wls_offline:/medrec> updateDomain()
wls_offline:/medrec> closeDomain()
Closes the current domain template. The domain template is no longer available once it is closed.
closeTemplate()
The following command closes the current domain template:
wls_offline:/> readTemplate(`c:/bea/weblogic81/common/templates/domains/
medrec.jar')
...
wls_offline:/medrec> writeDomain(`c:/bea/user_projects/domains/medrec')
wls_offline:/medrec> closeTemplate()
Disconnects WLST from the user session and closes the scripting shell.
exit()
The following example instructs WLST to disconnect from the user session and close the scripting shell:
wls_offline:/> exit()
Exiting WLS scripting shell ...
c:\>
Opens an existing domain for updating.
readDomain(domainDirName
)
The following command opens the specified domain for editing:
wls_offline:/> readDomain(`c:/bea/user_projects/domains/medrec')
wls_offline:/medrec>
Opens an existing domain template for domain creation.
readTemplate(templateFileName
)
The following command opens the specified domain template for domain creation:
wls_offline:/> readTemplate(`c:/bea/weblogic81/common/templates/domains
/medrec.jar')
wls_offline:/medrec>
Updates and saves the current domain. The domain continues to be editable after you update and save it.
updateDomain()
The following command updates and saves the current domain:
wls_offline:/> readDomain(`c:/bea/user_projects/domains/medrec')
...
wls_offline:/medrec> updateDomain()
Writes the domain configuration information to the specified directory. The domain continues to be editable after you execute this 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 . |
writeDomain(domainDir
)
The following command writes the domain configuration information to the specified directory:
wls_offline:/> readTemplate(`c:/bea/weblogic81/common/templates/domains
/medrec.jar')
...
wls_offline:/medrec> writeDomain(`c:/bea/user_projects/domains/medrec')
The cd
command navigates the hierarchy of configuration objects. This command uses a model that is similar to navigating a file system in a Windows or UNIX command shell. You can navigate to configuration objects in the current hierarchy and to any child or instance.
To navigate back to a parent resource, enter the cd('..')
command. To get back to the root configuration object after navigating to a resource that is deep in the hierarchy, enter the cd('/')
command.
The cd
command returns a stub of the configuration object instance, if one exists.
Note: | The cmo variable is initialized to the root of all domain configuration objects. As you navigate, it is updated to the current configuration object. |
cd(path
)
The following example shows how to navigate the hierarchy of configuration objects:
wls_offline:/medrec> cd('Server')
wls_offline:/medrec/Server> cd('MedRecServer')
wls_offline:/medrec/Server/MedRecServer> cd('../..')
wls_offline:/medrec>
Table 4 lists the WLST offline configuration Edit commands that you use to interrogate and edit configuration objects.
Assigns configuration objects to one or more destinations.
assign(sourceType, sourceName, destinationType, destinationName
)
Use the following guidelines for setting the sourceType
and destinationType
:
The following example performs the following assignments:
myServer
and myServer2
to the cluster myCluster
.MedRecEAR
to the target server newServer
.newUser
to the group Monitors
.wls_offline://medrec> assign("Server", "myServer,myServer2", "Cluster", "myCluster")
wls_offline://medrec> assign("Application", "MedRecEAR", "Target", "newServer")
wls_offline://medrec> assign("User", "newUser", "Group", "Monitors")
Assigns all applications or services to one or more destinations.
Note: | Note that you must assign JMS server and JMS distributed destinations using the assign() command, as described in assign. |
assignAll(sourceType, destinationType, destinationName
)
The following example assigns all services to the servers adminServer
and cluster1
.
wls_offline:/mydomain> assignAll("Services", "Target", "adminServer,cluster1")
The following services, if present, are assigned to the specified targets: MigratableRMIService
, Shutdownclass
, Startupclass
, FileT3
, RMCFactory
, MailSession
, MessagingBridge
, JMSConnectionFactory
, JDBCConnectionPool
, JDBCMultipool
, JDBCTxDatasource
, JDBCDataSource
, JDBCPoolComp
, JoltConnectionPool
, WLECConnectionPool
, and WTCServer
.
Creates a child object with the specified name and type for the current configuration object. The create
command returns a stub for the newly created configuration object.
Note: | Child types must be created under an instance of their parent type. |
create(Name
,childObjectType
)
The following example creates a child object of type Server
named newServer for the current configuration object, storing the stub as server1
:
wls_offline:/medrec> server1=create('newServer','Server')
wls_offline:/medrec> server1.getName()
`newServer'
Deletes an instance of a child object with the specified name and type for the current configuration object.
delete(Name
,childObjectType
)
The following example deletes the child object of type Server
named newServer for the current configuration object:
wls_offline:/medrec> delete('newServer','Server')
Returns the value of the specified attribute for the current configuration object.
Note: | You can list all attributes and their current values using the a argument to the ls command. For more information, see ls. |
Alternatively, you use the cmo
variable to perform any get method on the current configuration object. For example:
For more information about the cmo
variable, see WLST Offline Configuration Variables.
get(attributeName
)
The following example returns the value of the AdministrationPort
for the current configuration object:
wls_offline:/medrec> get('AdministrationPort')
9002
Loads SQL files into a database.
Before executing this command, ensure that the following conditions are true:
To verify that the appropriate SQL files exist, open the domain template and locate the relevant SQL file list, jdbc.index
, in the _jdbc_
directory. For example, for PointBase version 4.4, the SQL file list is located at _jdbc_\Pointbase\44\jdbc.index
.
The command fails if the above conditions are not met.
loadDB(DBVersion
,connectionPoolName
)
The following example loads SQL files, intended for version 4.4 of the database, using the myPool-PointBase
JDBC connection pool:
wls_offline:/mydomain> loadDB(`4.4', `myPool-PointBase')
Sets the specified attribute value for the current configuration object.
Note: | You can list all attributes and their current values using the a argument to the ls command. For more information, see ls. |
When you use offline WLST to set password attributes, you need to use the encrypted attribute. For example, to update CustomIdentityKeyStorePassPhrase
, you have to use the CustomIdentityKeyStorePassPhraseEncrypted
attribute. In this example, if you do not use the encrypted attribute, the "Unable to find attribute CustomIdentityKeyStorePassPhrase
" message appears.
Alternatively, you use the cmo
variable to perform any set method on the current configuration object. For example:
For more information about the cmo
variable, see WLST Offline Configuration Variables.
set(attributeName
,attributeValue
)
The following example sets the ArchiveConfigurationCount
attribute of DomainMBean
to 10
:
wls_offline:/mydomain/config> set('ArchiveConfigurationCount',10)
wls_offline:/mydomain/config>
Sets options related to a domain creation or update.
setOption(optionName,optionValue
)
The following example sets the CreateStartMenu
option to false
:
wls_offline:/> setOption('CreateStartMenu', 'false')
Unassign configuration objects from one or more destinations.
unassign(sourceType, sourceName, destinationType, destinationName
)
Use the following guidelines for setting the sourceType
and destinationType
:
The following example unassigns the following resources:
myServer
and myServer2
from the cluster myCluster
.MedRecEAR
from the target server newServer
.newUser
from the group Monitors
.wls_offline:/medrec> unassign("Server", "myServer,myServer2", "Cluster", "myCluster")
wls_offline:/medrec> unassign("Application", "MedRecEAR", "Target", "newServer")
wls_offline:/medrec> unassign("User", "newUser", "Group", "Monitors")
Unassigns all applications or services from one or more destinations.
unassignAll(sourceType, destinationType, destinationName
)
The following example unassigns all services from the servers adminServer
and cluster1
.
wls_offline:/medrec> unassignAll("Services", "Target", "adminServer,cluster1")
The following services, if present, are unassigned from the specified targets: MigratableRMIService
, Shutdownclass
, Startupclass
, FileT3
, RMCFactory
, MailSession
, MessagingBridge
, JMSConnectionFactory
, JDBCConnectionPool
, JDBCMultipool
, JDBCTxDatasource
, JDBCDataSource
, JDBCPoolComp
, JoltConnectionPool
, WLECConnectionPool
, and WTCServer
.
Table 5 lists the information commands for WLST offline configuration that are useful for interrogating domains, servers, and variables, and providing configuration object and WLST-related information.
Each command is described in detail in the following sections.
Displays any stack trace that was produced while performing a WLST action.
This example instructs WLST to display the stack trace.
wls_offline:/medrec> dumpStack()
com.bea.plateng.domain.script.jython.WLSTException: java.lang.reflect.Invocation TargetException
...
Displays all the variables used by WLST, including their name and value.
This example instructs WLST to display all the current variables and their values.
wls_offline:/platform>dumpVariables()
cmo: Proxy for medrec: Name=medrec, Type=DomainConfig
exitonerror: true
isrecording: false
Provides syntax and usage information for all categories of WLST commands, when no arguments are specified, or for a single command or variable, when a command or variable name argument is specified.
The help
command will support a query; for example, help('get*')
displays the syntax and usage information for all commands that begin with get
.
help([`name
'])
In the following example, information about using the get
command is requested:
wls:/medrec> help('get')
The command returns the following:
Description:
Get any attribute for the currently navigated configuration object.
Syntax:
get(AttributeName)
AttributeName = current configuration object's attribute name.
Example:
wls_offline:/medrec/Server/MedRecServer>get('AcceptBacklog')
50
wls_offline:/medrec/Server/MedRecServer>
Lists all the child objects or attributes for current configuration object.
You can optionally control the output by specifying an optional argument.
Table 6 describes the ls
command output information.
ls(['a' | 'c'])
The following command displays the child objects for the current configuration object:
wls_offline:/medrec> ls()
drw- Application
drw- Cluster
drw- FileRealm
drw- JDBCConnectionPool
drw- JDBCTxDataSource
drw- JMSConnectionFactory
drw- MailSession
drw- PasswordPolicy
drw- Realm
drw- Security
drw- Server
The following command displays all the attribute names and values for the current configuration object:
wls_offline:/medrec> ls('a')
-rw- AdministrationPort 9002
-rw- AdministrationPortEnabled false
-rw- AutoConfigurationSaveEnabled false
-rw- ConfigurationVersion 8.1.2.0
-rw- ConsoleContextPath console
-rw- ConsoleEnabled true
-rw- LastModificationTime 0
-rw- Name medrec
-rw- Notes null
-rw- ProductionModeEnabled false
wls_offline:/medrec>
Toggles the display of the configuration object navigation 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 configuration object navigation path. For WLST offline configuration, when you disable the prompt details, the prompt displays as follows: wls_offline:/>
. In this case, to determine your current location in the hierarchy, you can use the pwd
command, as described in pwd. By default, the WLST prompt displays the configuration object navigation path information.
prompt([`off'|'on'])
The following example instructs WLST to hide and redisplay the configuration object navigation path information at the prompt:
wls_offline:/medrec/Server/MedRecServer> prompt()
wls_offline:/>
wls_offline:/> prompt()
wls_offline:/medrec/Server/MedRecServer
The following example instructs WLST to hide the prompt and default to the Jython prompt, change the Jython prompt, and redisplay the WLST prompt:
wls_offline:/medrec/Server/MedRecServer> prompt('off')
>>>
>>>sys.ps1="myprompt>"
myprompt>
myprompt> prompt('on')
wls:/medrec/Server/MedRecServerfs>
Displays the current location in the hierarchy of the configuration tree.
pwd()
The following command displays the current location in the hierarchy of the configuration object:
wls_offline:/medrec> pwd()
/medrec
Records all user interactions with WLST; useful for capturing commands.
startRecording(
recordFilePath
)
The following example instructs WLST to begin recording WLST commands in the record.py
file:
wls_offline:/> startRecording(`c:/myScripts/record.py')
Starting recording to c:\myScripts\record.py
Stops recording WLST commands.
The following example instructs WLST to stop recording WLST commands:
wls_offline:/> stopRecording()
Stopping recording to c:\myScripts\record.py
![]() ![]() ![]() |