Saturday, October 23, 2010

WLST ( Weblogic Scripting Tool ) - II

The WebLogic Scripting Tool (WLST) is a command-line scripting environment that you can use to create, manage, and monitor WebLogic Server domains. 

It is based on the Java scripting interpreter, Jython. 

In addition to supporting standard Jython features such as local variables, conditional variables, and flow control statements, WLST provides a set of scripting functions (commands) that are specific to WebLogic Server.

You can use WLST as the command-line equivalent to the WebLogic Server Administration Console (WLST online) or as the command-line equivalent to the Configuration Wizard (WLST offline)


You can use WLST to connect to a running Administration Server and manage the configuration of an active domain, view performance data about resources in the domain, or manage security data (such as 
adding or removing users).


Without connecting to a running WebLogic Server instance, you can use WLST to create domain templates, create a new domain based on existing templates, or extend an existing, inactive domain. You cannot use WLST offline to view performance data about resources in a domain or modify security data (such as adding or removing users).


Interactive Mode

Interactive mode, in which you enter a command and view the response at a command-line prompt

Script Mode

Scripts invoke a sequence of WLST commands without requiring your input, much like a shell script

Embedded Mode

In embedded mode, you instantiate the WLST interpreter in your Java code and use it to run WLST commands and scripts

Setting Up Your Environment

Run under <Domain>/bin directory.

Invoking WLST

To use WLST in interactive mode:java weblogic.WLST
To connect to a WebLogic Server instance after you start WLST in interactive mode:wls:/offline> connect('weblogic','weblogic','localhost:7001')
To use WLST in script mode:java weblogic.WLST c:\myscripts\

Exiting WLST

To exit WLST, enter the exit() command:
wls:/mydomain/serverConfig> exit()Exiting WebLogic Scripting Tool ...

Syntax for WLST Commands

Follow this syntax when entering WLST commands or writing them in a script:
  • Command names and arguments are case sensitive.
  • Enclose arguments in single or double quotes. For example, 'newServer' or "newServer".
  • If you specify a backslash character (\) in a string, either precede the backslash with another backslash or precede the entire string with a lower-case r character. The \ or r prevents Jython from interpreting the backslash as a special character.
  • For example when specifying a file pathname that contains a backslash:
    readTemplate('c:\\userdomains\\mytemplates\\mytemplate.jar') or readTemplate(r'c:\userdomains\mytemplates\mytemplate.jar')
  • When using WLST offline, the following characters are not valid in names of management objects: period (.), forward slash (/), or backward slash (\).
  • If you need to cd to a management object whose name includes a forward slash (/), surround the object name in parentheses. For example:
    Start Node Manager
    if Node Manager is not already running, you can log on to the host computer and use WLST to start it:
    c:\>java weblogic.WLST wls:/offline> startNodeManager()
    Connect WLST to a Node Manager by entering the nmConnect command.
    For example,
    nmConnect('weblogic', 'weblogic', 'localhost', '5556', 'mydomain','c:/bea/user_projects/domains/mydomain','ssl')
    Connecting to Node Manager ... Successfully connected. wls:/nm/mydomain>
    Use the nmStart command to start a server.
    wls:/nm/mydomain>nmStart('AdminServer') starting server AdminServer ... Server AdminServer started successfully wls:/nm/mydomain>
    Monitor the status of the Administration Server by entering the nmServerStatus command.
    wls:/nm/mydomain>nmServerStatus('serverName') RUNNING wls:/nm/mydomain>
    Stop the server by entering the nmKill command.
    Killing server AdminServer Server AdminServer killed successfully wls:/nm/mydomain>
    To start a Managed Server, enter the following command:
    where managedServerName is the name of the server.
    For example,

    To start a cluster, enter the following command:

    start('clusterName', 'Cluster')
    where clusterName is the name of the cluster.
    For example:
    start('mycluster', 'Cluster')

No comments:

Post a Comment