Skip navigation.

WebLogic Scripting Tool

  Previous Next vertical dots separating previous/next from contents/index/pdf Contents View as PDF   Get Adobe Reader

Managing Servers and Server Life Cycle

The following sections describe how to start and stop WebLogic Server instances and monitor and manage the server life cycle using WebLogic Scripting Tool (WLST):


Managing the Server Life Cycle

During its lifetime, a server can transition through a number of operational states, such as shutdown, starting, standby, admin, resuming, and running. WLST commands such as start, suspend, resume, and shutdown cause specific changes to the state of a server instance.

Using WLST, you can:

For more information about the server life cycle and managing servers, see "Understanding Server Life Cycle" and "Using Node Manager to Control Servers" in Managing Server Startup and Shutdown.


Starting and Stopping Servers

WebLogic Server provides several ways to start and stop server instances. The method that you choose depends on whether you prefer using a graphical or command-line interface, and on whether you are using the Node Manager to manage a server's life cycle.

For an overview of methods for starting and stopping server instances, see "Starting and Stopping Servers" in Managing Server Startup and Shutdown.

Starting an Administration Server Without Node Manager

To start an Administration Server without using Node Manager:

  1. If you have not already done so, use WLST to create a domain.
  2. For more information, see Creating and Configuring WebLogic Domains Using WLST Offline.

  3. Open a shell (command prompt) on the computer on which you created the domain.
  4. Change to the directory in which you located the domain.
  5. By default, this directory is BEA_HOME\user_projects\domains\domain_name, where BEA_HOME is the top-level installation directory of BEA products.

  6. Set up your environment by running one of the following scripts:
  7. On Windows, you can use a shortcut on the Start menu to set your environment variables and invoke WLST (Tools—>WebLogic Scripting Tool).

  8. Invoke WLST by entering: java weblogic.WLST
  9. The WLST prompt appears.


  10. Use the WLST startServer command to start the Administration Server.
  11. startServer([adminServerName], [domainName], [url], [username], [password],[domainDir], [block], [timeout], [useNM], [serverLog], [systemProperties], [jvmArgs])

    For detailed information about startServer command arguments, see startServer.

    For example,


The optional useNM argument specifies whether to use Node Manager to start the server; this argument defaults to true, indicating that Node Manager will be used. By specifying false, this command starts the Administration Server without using Node Manager. However, if you use Node Manager to start the Administration Server, Node Manager supports starting, stopping, and restarting it if it fails. See Using WLST and Node Manager to Manage Servers.

After WLST starts a server instance, the server runs in a separate process from WLST; exiting WLST does not shut down the server.

Starting Managed Servers and Clusters With Node Manager

To start Managed Servers and clusters using Node Manager:

  1. Invoke WLST and start an Administration Server, as described in Starting an Administration Server Without Node Manager.
  2. Start Node Manager.
  3. The WebLogic Server custom installation process optionally installs and starts Node Manager as a Windows service on Windows systems. See "About Node Manager Installation as a Windows Service" in the Installation Guide. For detailed instructions, see "Starting and Running Node Manager" in Managing Server Startup and Shutdown.

    On Windows you can use a shortcut on the Start menu to start the Node Manager (Tools —> Node Manager).

    If it's not already running, you can start Node Manager manually at a command prompt by invoking WLST and entering the startNodeManager command:

    c:\>java weblogic.WLST
    wls:/offline> startNodeManager()

    For more information about startNodeManager, see startNodeManager.

  4. Invoke and connect WLST to a running WebLogic Administration Server instance using the connect command.
  5. c:\>java weblogic.WLST
    wls:/(offline)> connect('username','password')
    Connecting to weblogic server instance running at t3://localhost:7001 as username weblogic ...
    Successfully connected to Admin Server 'myserver' 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.


    For detailed information about connect command arguments, see connect.

  6. Start a Managed Server instance by entering the start command.
  7. wls:/mydomain/serverConfig> start('managedServerName','Server','managedServerURL')

    For example,


  8. For each Managed Server in the Administration Server's domain that you want to start, repeat step 4.
  9. The start command starts Managed Servers or clusters in a domain using Node Manager. To use the start command, WLST must be connected to a running Administration Server. To start Managed Servers without requiring a running Administration Server, use the nmStart command with WLST connected to Node Manager. See Using WLST and Node Manager to Manage Servers.

    To start clusters,

    wls:/mydomain/serverConfig> start('mycluster', 'Cluster')
    Starting the following servers in Cluster, mycluster: MS1, MS2, MS3...
    All servers in the cluster mycluster are started successfully.

    For more information, see start.


Using WLST and Node Manager to Manage Servers

Node Manager is a utility for the remote control of WebLogic Server instances that lets you monitor, start, and stop server instances—both Administration Servers and Managed Servers—and automatically restart them after a failure. For more information about Node Manager, see "Using Node Manager to Control Servers" in Managing Server Startup and Shutdown.

You can start, stop, and restart server instances remotely or locally, using WLST as a Node Manager client. In addition, WLST can obtain server status and retrieve the contents of the server output log.

You connect WLST to a running Node Manager instance in order to invoke Node Manager supported commands. Node Manager commands issued via WLST are processed by the Node Manager on the system hosting the target server instances. After being authenticated by Node Manager, you need not re-authenticate each time you enter a Node Manager command.

In addition, you can enroll the machine on which WLST is running to be monitored by Node Manager by entering the nmEnroll command. You must run this command once per domain per machine unless that domain shares the root directory of the Administration Server. WLST must be connected to an Administration Server to run this command; WLST does not need to be connected to the Node Manager. See nmEnroll.

Communications from WLST to the Node Manager process on a machine include:

The following example uses WLST Node Manager commands to start, monitor, and stop an Administration Server.

  1. Invoke WLST.
  2. java weblogic.WLST

  3. Connect WLST to Node Manager by entering the nmConnect command.
  4. wls:/offline>nmConnect('username','password','nmHost','nmPort','domainName','domainDir','nmType')

    For example,

    nmConnect('weblogic', 'weblogic', 'localhost', '5556', 'mydomain','c:/bea/user_projects/domains/mydomain','ssl')

    Connecting to Node Manager ...
    Successfully connected.

    For detailed information about nmConnect command arguments, see nmConnect.

    After successfully connecting WLST to Node Manager, you can start, monitor, and stop Administration and Managed Server instances.

    When connected to Node Manager, the nmStart command starts Managed Servers without requiring a running Administration Server.

  5. Use the nmStart command to start an Administration Server.
  6. wls:/nm/mydomain>nmStart('serverName')
    starting server AdminServer
    Server AdminServer started successfully

  7. Monitor the status of the server you started by entering the nmServerStatus command.
  8. wls:/nm/mydomain>nmServerStatus('serverName')

  9. Stop the server by entering the nmKill command.
  10. wls:/nm/mydomain>nmKill('serverName')
    Killing server AdminServer
    Server AdminServer killed successfully

For more information about WLST Node Manager commands, see Node Manager Commands.


Monitoring Server State

WebLogic Server displays and stores information about the current operational state of a server instance and state transitions that have occurred since the server instance started up. This information is useful to administrators who:

Using WLST, you can obtain the state of a server instance in the following ways:

To tailor WLST server monitoring, shutdown, and restart behaviors, see Script for Monitoring Server State.


Managing Server State

WLST life cycle commands let you control the states through which a server instance transitions. See Life Cycle Commands.

The commands in Listing 5-1 explicitly move WebLogic Server through the following server states: RUNNING->ADMIN->RUNNING->SHUTDOWN.

Start WebLogic Server before running this script. See Running Scripts.

Listing 5-1 WLST Life Cycle Commands

# First enable the Administration Port. This is Not a requirement.
# check the state of the server
# now move the server from RUNNING state to ADMIN
suspend("myserver", block="true")
# check the state
# now resume the server to RUNNING state
# check the state
# now take a thread dump of the server
# finally shutdown the server


Skip navigation bar  Back to Top Previous Next