Starting / Stopping WebLogic Server - (Release 8.1.2)

by Jeff Hunter, Sr. Database Administrator


Contents

  1. Overview
  2. The Server Life Cycle
  3. Configuring your Environment
  4. Starting WebLogic Server
  5. Stopping WebLogic Server


Overview

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
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.

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.

cd C:\bea\weblogic81\server\bin
call setWLSEnv.cmd
Starting WebLogic Server
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.

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:

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.
Stopping WebLogic Server
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.

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:

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: 169117