WebLogic Scripting Tool

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

Creating Domains Using WLST Offline

WLST enables you to create a new domain or update an existing domain without connecting to a running WebLogic Server (that is, using WLST offline)—supporting the same functionality as the Configuration Wizard.

The following sections describe how to create and configure WebLogic domains using WLST offline:

For information about sample scripts that you can use to create domains, see WLST Offline Sample Scripts.

For more information about the Configuration Wizard, see Creating WebLogic Domains Using the Configuration Wizard.

 


Creating and Using a Domain Template (Offline)

A domain template is a JAR file that contains domain configuration documents, applications, security data, startup scripts, and other information needed to create a domain. To create and use a domain template, perform the steps described in Table 3-1.

Table 3-1 Steps for Creating a Domain Template (Offline) 
To...
Use this command...
For more information, see...
  1. Open an existing domain or template
readDomain(domainDirName)
readTemplate(templateFileName)
  1. (Optional) Modify the domain
Browsing and editing commands
  1. Set the password for the default user, if it is not already set
  2. The default username and password must be set before you can write the domain template.

cd('/Security/domainname/User/username')
cmo.setPassword('
password')
  1. Write the domain configuration information to a domain template
writeTemplate(templateName)
  1. Use the template to create a domain
createDomain(domainTemplate,
domainDir, user, password)

Note: The Configuration Wizard can also use the domain template. See Creating WebLogic Domains Using the Configuration Wizard.

Browsing Information About the Configuration Hierarchy (Offline)

WLST offline provides read and write access to the configuration data that is persisted in the domain’s config directory or in a domain template JAR created using Template Builder. This data is a collection of XML documents and expresses a hierarchy of management objects. The schemas that define a domain’s configuration document are in the following locations:

WLST represents this hierarchy as a file system. The root of the file system is the management object that represents the WebLogic Server domain. Below the domain directory is a collection of directories for managed-object types; each instance of the type is a subdirectory under the type directory; and each management attribute and operation is a file within a directory. The name of an instance directory matches the value of the management object’s Name attribute. If the management object does not have a Name attribute, WLST generates a directory name using the following pattern: NO_NAME_number, where number starts at 0 (zero) and increments by 1 for each additional instance.

To navigate the hierarchy, you use such WLST commands as cd, ls, and pwd in a similar way that you would navigate a file system in a UNIX or Windows command shell (see Table 3-2).

Note: As a performance optimization, WebLogic Server does not store most of its default values in the domain’s configuration files. In some cases, this optimization prevents entire management objects from being displayed by WLST offline (because WebLogic Server has never written the corresponding XML elements to the domain’s configuration files). For example, if you never modify the default logging severity level for a domain while the domain is active, WLST offline will not display the domain’s Log management object.
Note: If you want to change the default value of attributes whose management object is not displayed by WLST offline, you must first use the create command to create the management object. Then you can cd to the management object and change the attribute value. See create.

Table 3-2 Displaying Domain Configuration Information (Offline) 
To...
Use this command...
For more information, see...
Navigate the hierarchy of management objects
cd(path)
List child attributes or management objects for the current management object
ls(['a' | 'c'])
Toggle the display of the management object navigation path information at the prompt
prompt(['off'|'on'])
Display the current location in the configuration hierarchy
pwd()
Display all variables used by WLST
dumpVariables()
Display the stack trace from the last exception that occurred while performing a WLST action
dumpStack()

Editing a Domain (Offline)

To edit a domain using WLST offline, you can perform any of the tasks defined in the following table.

Table 3-3 Editing a Domain 
To...
Use this command...
For more information, see...
Add an application to a domain
addTemplate(templateFileName)
Assign resources to one or more destinations (such as assigning servers to clusters)
assign(sourceType, sourceName, destinationType, destinationName)
Unassign resources
unassign(sourceType, sourceName, destinationType, destinationName)
Create and delete management objects
create(name, childMBeanType)
delete(name, childMBeanType)
Get and set attribute values
get(attrName)
set(attrName, value)
Set configuration options
setOption(optionName, value)
Load SQL files into a database
loadDB(dbVersion, connectionPoolName)

 


Alternative: Using the configToScript Command

WLST includes a command, configToScript, that reads an existing domain and outputs a WLST script that can recreate the domain. See configToScript.

Unlike creating and using a domain template, the configToScript command creates multiple files that must be used together. (A domain template is a single JAR file.) In addition, the script that the configToScript command creates:

 


Considerations for Clusters, JDBC, and JMS Resources

When using WLST offline to create or extend a clustered domain with a template that has applications containing application-scoped JDBC and/or JMS resources, you may need to perform additional steps (after the domain is created or extended) to make sure that the application and its application-scoped resources are targeted and deployed properly in a clustered environment. For more information on the targeting and deployment of application-scoped modules, see “Deploying Applications and Modules with weblogic.deployer” in Deploying Applications to WebLogic Server.

If you want to use JDBC resources to connect to a database, modify the environment as the database vendor requires. Usually this entails adding driver classes to the CLASSPATH variable and vendor-specific directories to the PATH variable. To set the environment that the sample PointBase database requires as well as add an SDK to PATH variable and the WebLogic Server classes to the CLASSPATH variable, invoke the following script:

WL_HOME\samples\domains\wl_server\setExamplesEnv.cmd (on Windows)
WL_HOME/samples/domains/wl_server/setExamplesEnv.sh (on UNIX)


  Back to Top       Previous  Next