|
Starting / Stopping WebLogic Server - (Release 8.1.2)
by Jeff Hunter, Sr. Database Administrator
Contents
Overview
The WebLogic Application Server
includes a Command Script (or Shell Script if you are running this on
UNIX) in the %WL_HOME%\server\bin directory named setWLSEnv.cmd.
You can run this script to set the needed environment variables for
running WebLogic Server commands.
WebLogic also includes a wrapper script that can be used to start a managed WebLogic Server.
This script it typically called startManagedWebLogic.cmd and is used as follows:
Keep in mind that a WebLogic Server can be shut down from anywhere within it's life cycle.
One way to shutdown a WebLogic Server is using the Administration Console. Simply right-click
on the server's node in the left pane and choose the "Start/Stop this server" option.
From here, you can simply select the "Shutdown this server" option from the right
pane.
You can also use the administration tool (a stand alone Java application) and use
the SHUTDOWN option. Keep in mind that using the SHUTDOWN option
will perform a graceful shutdown of the server.
In the following example, I want to shutdown a server (gracefully)
named examplesServer, located on a server named bartman running on
port 7001:
The following article presents a brief overview on starting and stopping a
WebLogic Server. Also provided in this article is an overview of the different
states that a WebLogic server can go through during its life cycle. The examples
in this document use the command-line for starting and stopping actions. You will
need to first setup your environment (i.e. CLASSPATH, PATH,
and several other environment variables) in order to run the command-line examples.
The Server Life Cycle
Before discussing the details of how to start and stop the WebLogic
application server, it is valuable to first talk about the different
states the application server can be in while being cycled. It is possible
to use either the WebLogic Administration Console or the weblogic.Admin
Java tool to explicitly move the application server to a new state. The following is
a listing of the various states the server can go through during its life cycle:
Configuring your Environment
A server is said to be in the shutdown state when it is not running. When
a server is in the shutdown state, the only thing you can do is start it.
A server is said to be in the starting state when it has been
started from the command line or by a Node Manager. When in this state,
the server contacts the Administration Server, retrieves its configuration
information, starts all services, deploys all applications, and finally executes
any startup classes.
A server is capable of moving into the standby state if an
administration port has been configured. Otherwise, the server will
move directly from the starting state to the running
state. When a server is in the standby state, all services
are initialized and all application get deployed. With the exception
of the administration port, however, all ports are closed. Therefore,
teh server is said to be in hot standby and ready to go.
When a server is in the running state, it is fully operational
and participating as a regular member of a WebLogic domain.
A server is moved into the suspending state during a graceful
shutdown. This allows the server to complete any processing it
may be working on to enable a clean shutdown without loss of any important
state information. This state will be skipped during a forced shutdown.
A server will be moved into the shutting down state after it
receives a shutdown command. If the server is in the
running or standby state when the shutdown command
is received, it shuts down gracefully, terminating all services and
executing any configured shutdown classes.
A server is moved into the failed state when the health monitoring
service determines that a critical service is not functioning properly during
its life cycle. Once a server is put into the failed state, it can
only be shut down. If you have enabled health monitoring, the Node Manager
can automatically shut down and restart the server if it fails.
A server is said to be in the unknown state if it cannot be contacted.
When running the command-line examples in this article, you will need to
set certain environment variables. (i.e. CLASSPATH, PATH).
First, let's assume that the location of your BEA WebLogic Server installation
was installed to C:\bea\weblogic81. I will refer to this location as
%WL_HOME% throughout the remainder of this article.
Starting WebLogic Server
cd C:\bea\weblogic81\server\bin
call setWLSEnv.cmd
I typically start all WebLogic servers from the command-line. When creating a domain,
it is common to create a script that will start the server(s). This script will
set many environment variables, start any databases (if required), and finally start
the WebLogic Server. The WebLogic Server is a Java application, namely weblogic.Server,
that will get called at the end of your start script.
Stopping WebLogic Server
Usage: startManagedWebLogic [SERVER_NAME] [ADMIN_URL]
for example:
startManagedWebLogic managedserver1 http://localhost:7001
Instead of providing the [SERVER_NAME] and [ADMIN_URL] parameters to the startManagedWebLogic.cmd,
you can set the SERVER_NAME and ADMIN_URL environment variables, then run
the script with no arguments.
There are two types of shutdown's that can be performed on a WebLogic
server - graceful and forced. With a graceful shutdown,
the server is transitioned through the following states - running,
suspending, standby, shuting down, and shutdown.
With a forced shutdown, the server is only transitioned through the standby
and then the shutdown state.
java weblogic.Admin
-url t3://bartman:7001/
-username weblogic -password weblogic
SHUTDOWN examplesServer
You can also use the FORCESHUTDOWN option to perform a forced shutdown. Keep in mind
that a forced shutdown can result in a loss of session-state information or could cause
currently active transactions to rollback.
java weblogic.Admin
-url t3://bartman:7001/
-username weblogic -password weblogic
FORCESHUTDOWN examplesServer
WebLogic 8.1 added several arguments to give you more control over shut down commands.
The -timeout option determines the maximum number of seconds WebLogic
should wait for a graceful shutdown to complete. What this does is set a limit
on the completion of pending in-flight tasks. Without this argument, WebLogic will
use the timeout value set for the server from the Administration Console, which by default
is set to 0, which means that the server will wait indefinitely. Another argument (actually
a flag) added to WebLogic 8.1 is -ignoreExistingSessions, which is used to drop
all HTTP sessions immediately. Without this argument, WebLogic uses the setting defined
in the Administation Console, which waits for all HTTP sesion to complete or time out.
Here is an example that uses both arguments:
java weblogic.Admin
-url t3://bartman:7001/
-username weblogic -password weblogic
SHUTDOWN -ignoreExistingSessions -timeout 10 examplesServer
Last modified on: Saturday, 18-Sep-2010 18:16:57 EDT
Page Count: 159350