WebLogic Scripting Tool
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
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):
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.
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.
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.
To start an Administration Server without using Node Manager:
For more information, see Creating and Configuring WebLogic Domains Using WLST Offline.
By default, this directory is BEA_HOME
\user_projects\domains\
domain_name
, where BEA_HOME
is the top-level installation directory of BEA products.
On Windows, you can use a shortcut on the Start menu to set your environment variables and invoke WLST (Tools
startServer([
adminServerName
], [
domainName
], [
url
], [
username
], [
password
],[
domainDir
], [
block
], [
timeout
], [
serverLog
], [
systemProperties
], [
jvmArgs
])
For detailed information about startServer
command arguments, see startServer.
wls:offline/>
startServer('AdminServer','mydomain','t3://localhost:7001','weblogic','weblogic','c:/bea/user_projects/domains/mydomain','true','60000','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.
To start Managed Servers and clusters using Node Manager:
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
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.
connect
command.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.
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.
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.
wls:/mydomain/serverConfig>
For more information, see start.
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.
wls:/offline>
nmConnect('username','password','nmHost','nmPort','domainName','domainDir','nmType')
nmConnect('weblogic', 'weblogic', 'localhost', '5556', 'mydomain','c:/bea/user_projects/domains/mydomain','ssl')
Connecting to Node Manager ...
>
Successfully connected.
wls:/nm/mydomain
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.
For more information about WLST Node Manager commands, see Node Manager Commands.
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:
state
command—returns the state of a server or cluster.wls:/mydomain/serverConfig>
state('managed1','Server')
Current state of 'managed1' : RUNNING
wls:/mydomain/serverConfig>
See state.
ServerRuntimeMBean
and display the State
attribute. To tailor WLST server monitoring, shutdown, and restart behaviors, see Script for Monitoring 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
connect("
username
","password
","t3://localhost:8001")
# First enable the Administration Port. This is Not a requirement.
edit()
startEdit()
cmo.setAdministrationPortEnabled(1)
activate(block="true")
# check the state of the server
state("myserver")
# now move the server from RUNNING state to ADMIN
suspend("myserver", block="true")
# check the state
state("myserver")
# now resume the server to RUNNING state
resume("myserver",block="true")
# check the state
state("myserver")
# now take a thread dump of the server
threadDump("./dumps/threadDumpAdminServer.txt")
# finally shutdown the server
shutdown(block="true")
![]() ![]() |
![]() |
![]() |