• USA : +1 973 910 5725
  • INDIA: +91 905 291 3388
  • info@tekslate.com
  • Login

Managing Server Startup and Shutdown

At the end of this tutorial you will be able to:

  • Start and Stop the Administration Server
  • Start and Stop Managed Servers
  • Configure the Managed Servers and Machines
  • Describe Managed Server Independence
  • Understanding Server Life Cycle and WLS Exit Codes

 

Introduction and Roadmap

This document describes how you manage BEA WebLogic Server® startup, shutdown, and server life cycle. It also describes WebLogic features that you help prevent and recover from server failure.

 

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 the Administration Console or a command-line interface, and on whether you are using Node Manager to manage the server’s life cycle.

No matter how you start a server, the end result passes a set of configuration options to initialize a Java Virtual Machine (JVM). The server instance runs within the JVM, and the JVM can host only one server instance.

 

Starting Servers: Before You Begin:

  • Meet version requirements
  • Create a domain
  • Provide user credentials
  • Set up Node Manager
  • Configure Managed Server connections to the Administration Server
  • Specify Java startup options

Starting an Administration Server:

  • Starting an Administration Server with a Startup Script

You can start an Administration Server with a default startup script or create your own. To start an Administration Server with the WebLogic Server-included startup script:

  1. Change to the directory in which you located the domain.

By default, this directory is BEA_HOME\user_projects\domains\DOMAIN_NAME, where DOMAIN_NAME is the root directory of the domain. (The name of this directory is the name of the domain.)

  1. Run one of the following scripts:

– bin/startWebLogic.cmd (Windows)

– bin\startWebLogic.sh (UNIX and Windows)

The startWebLogic script does the following:

  1. Sets environment variables by invoking DOMAIN_NAME\bin\setDomainEnv.cmd (setDomainEnv.sh on UNIX).
  2. Invokes the java weblogic.Server command, which starts a JVM that is configured to run a WebLogic Server instance

When the server successfully completes its startup process, it writes the following message to standard out (which, by default, is the command window):

<Notice> <WebLogicServer> <BEA-000360> <Server started in RUNNING mode>

 

2) Starting an Administration Server from the Windows Start Menu

When you create an Administration Server on a Windows computer, the Configuration Wizard creates a shortcut on the Start Menu for starting the server (User Projects→DOMAIN_NAME→Start Admin Server for WebLogic Domain).

 

3) Starting an Admin Server with the java weblogic.Server Command

The weblogic.Server class is the main class for a WebLogic Server instance. You start a server instance by directly invoking weblogic.Server in a Java command.

Run WL_HOME/server/bin/setWLSEnv.sh then run java weblogic.Server with the following Options if it is required

–Xms256m –Xmx512m

-Dweblogic.Name=%SERVER_NAME% -Dplatform.home=C:\bea\weblogic91

-Dweblogic.management.username=%WLS_USER%

-Dweblogic.management.password=%WLS_PW%

-Dweblogic.management.server=%ADMIN_URL%

-Dweblogic.ProductionModeEnabled=%STARTMODE%

-Djava.security.policy=%WL_HOME%\server\lib\weblogic.policy

Note: Oracle recommends using java weblogic.Server primarily for initial development but not as a standard mechanism for starting production systems for the following reasons:

  • java weblogic.Server will not function if you select a product directory outside of the BEA home directory.
  • When executing java weblogic.Server, patches will not be recognized by the WebLogic Server runs time.

 

4) Starting an Administration Server Using WLST and Node Manager

Node Manager is a utility for remote control of WebLogic Server instances. Using Node Manager you can control and monitor Managed Servers and also, start, stop, and restart Administration Servers.

You can access these Node Manager features using the WebLogic Scripting Tool commands and scripts. If you use the nmStart command with WLST connected to a Node Manager, Node Manager supports monitoring, stopping, and restarting the Administration Server.

 

5) Starting an Admin Server Using WLST without Node Manager

The WLST startServer command starts the Administration Server without using Node Manager. The server runs in a separate process from WLST; exiting WLST does not shut down the server. See Starting an Administration Server Without Node Manager in WebLogic Scripting Tool.

For example,

wls:offline/>startServer(‘AdminServer’,’mydomain’,’t3://localhost:7001′,’weblogic’,’weblogic’,’c:/bea/user_projects/domains/mydomain’,’true’,’60000′,’false’)

Starting Managed Servers:

 

1) Starting Managed Servers with a Startup Script

If you use one of the Configuration Wizard templates that WebLogic Server provides, your domain directory includes a start script named startManagedWebLogic that you can use to start Managed Servers. You can use this script to start all the Managed Servers in a cluster.

  1. Start the domain’s Administration Server.
  1. In a shell (command prompt) on the computer that hosts the Managed Server, change to the directory that contains the startManagedWebLogic script:

DOMAIN_NAME\bin\startManagedWebLogic.cmd (Windows)

DOMAIN_NAME/bin/startManagedWebLogic.sh (UNIX)

  1. Enter one of the following commands:

– startManagedWebLogic.cmd managed_server_name admin_url (Windows)

– startManagedWebLogic.sh managed_server_name admin_url (UNIX)

Ex: startManagedWebLogic.cmd ms1 http://localhost:7001

The startManagedWebLogic script does the following:

  1. Calls the startWebLogic script, which sets the environment variables by invoking

WL_HOME\user_projects\domains\DOMAIN_NAME\bin\setDomainEnv.cmd

(setDomainEnv.sh on UNIX).

  1. Invokes the java weblogic.Server command, which starts a JVM that is configured to run a WebLogic Server instance. When the server successfully completes its startup process, it writes the following message to standard out (which, by default, is the command window):

<Notice> <WebLogicServer> <000360> <Server started in RUNNING mode>

 

2) Starting Managed Servers from the Administration Console

68

 

3) Starting Managed Servers and Clusters with WLST and Node Manager

  • Invoke WLST by entering: java weblogic.WLST
  • The WLST prompt appears. wls:/(offline)>
  • Use the WLST startServer command to start the Administration Server.

startServer([adminServerName], [domainName], [url], [username], [password],[domainDir], [block], [timeout], [serverLog], [systemProperties], [jvmArgs] [spaceAsJvmArgsDelimiter])

  • For example,
  • wls:offline/>startServer(‘AdminServer’,’mydomain’,’t3://localhost:7001′,’weblogic’,’weblogic’,’c:/bea/user_projects/domains/mydomain’,’true’,’60000′,’false’)

To start a Managed Server, enter the following command:

  • start(‘managedServerName’,’Server’) where managedServerName is the name of the server.
    • For example, start(‘managed1′,’Server’)

– To start a cluster, enter the following command:

start(‘clusterName’, ‘Cluster’) where clusterName is the name of the cluster.

For example:  start(‘mycluster’, ‘Cluster’)

4) Starting Managed Servers with the java weblogic.Server Command

The weblogic.Server class is the main class for a WebLogic Server instance. You start a server instance by directly invoking weblogic.Server in a Java command.

 

Run WL_HOME/server/bin/setWLSEnv.sh then run java weblogic.Server with the following Options if it is required

–Xms256m –Xmx512m

-Dweblogic.Name=%SERVER_NAME% -Dplatform.home=C:\bea\weblogic91

-Dweblogic.management.username=%WLS_USER%

-Dweblogic.management.password=%WLS_PW%

-Dweblogic.management.server=%ADMIN_URL%

-Dweblogic.ProductionModeEnabled=%STARTMODE%

-Djava.security.policy=%WL_HOME%\server\lib\weblogic.policy

 

Shutting Down Instances of WebLogic Server

Shutting Down Servers with a Stop Script

For an Administration Server, invoke:

  • DOMAIN_NAME\bin\stopWeblogic.cmd username password admin_url (Windows)
  • DOMAIN_NAME/bin/stopWeblogic.sh username password admin_url (UNIX)

For Managed Servers, invoke:

  • DOMAIN_NAME\bin\stopManagedWeblogic.cmd managed_server_name admin_url username password (Windows)
  • DOMAIN_NAME/bin/stopManagedWeblogic.sh managed_server_name admin_url username password (UNIX)

Note: On the command line, specify parameters in the order shown. User credentials come before the ADMIN_URL with stopWebLogic.cmd and after the ADMIN_URL with stopManagedWebLogic.cmd.

  

Killing the JVM

 

Each WebLogic Server instance runs in its own JVM. If you are unable to shut down a server instance using the methods described in the previous sections, you can use an operating system command to kill the JVM.

Caution: If you kill the JVM, the server immediately stops all processing. Any session data is lost. If you kill the JVM for an Administration Server while the server is writing to the config.xml file, you can corrupt the config.xml file.

Some common ways to kill the JVM are as follows:

  • If the shell in which you start the server is still open, you can type Ctrl-C.
  • On a Windows computer, you can use the Task Manager to kill a JVM.
  • On a UNIX computer, you can use the ps command to list all running processes. Then you can use the kill command to kill the JVM.

 

Configuring a Domain

 

  • After installing, configure a WLS domain on which to develop and deploy applications.
  • When you create a domain, you define a collection of resources, such as:
    • Managed servers
    • Clusters
    • Database connections
    • Security services
    • J2EE applications
  • Use the Configuration Wizard to create and configure WLS domains.

 

Configuring Managed Servers

We can configure the Managed Server in three ways:

  • Through Domain Configuration Wizard
  • Through Admin Console

 

69

 

Configuring Machines

We can configure the Machines in three ways:

  • Domain Configuration Wizard
  • Admin Console
  • WLST

70

Creating a Boot Identity File

  • Create a file called boot.properties located in the domain’s root directory containing 2 lines:
    • username=username
    • password=password
  • First time you start the server, the server reads the Boot Identity file and overwrites it with an encrypted version of the username and password.
  • Thereafter, the server will remember your identity for the subsequent startup cycles.

 

Running Multiple WLS Instances:

  • You can run multiple instances of WLS using different configurations on the same physical machine at the same time by:
    • Assigning multiple IP address to a machine (multihoming) and defining each server to use a unique IP address
  • or by:
    • Specifying the same IP address but using different listen ports

 

Multihoming

  • A multihomed machine:
    • Is a machine with multiple IP addresses
    • Can run a different WLS instance bound to each IP address
    • Can be used to configure a cluster on a single machine

 

What Happens if the Administration Server Fails?

The failure of an Administration Server does not affect the operation of Managed Servers in the domain but it does prevent you from changing the domain’s configuration. If an Administration Server fails because of a hardware or software failure on its host machine, other server instances on the same machine may be similarly affected. However, the failure of an Administration Server itself does not interrupt the operation of Managed Servers in the domain.

If an Administration Server for a domain becomes unavailable while the server instances it manages—clustered or otherwise—are up and running, those Managed Servers continue to run. Periodically, the Managed Servers attempt to reconnect to the Administration Server. If the domain contains clustered server instances, the load balancing and failover capabilities supported by the domain configuration remain available, even if the Administration Server fails.

You can start a Managed Server even if the Administration Server is not running. In this case, the Managed Server uses a local copy of the domain’s configuration files for its starting configuration and then periodically attempts to connect with the Administration Server. When it does connect, it synchronizes its configuration state with that of the Administration Server.

  • The administration server:
    • Can go down without affecting the operation of managed servers
    • Can be restarted while managed servers are still running
  • When an administration server goes down:
    • Domain log entries are lost while it is down
    • Managed servers can start in independent mode
    • The administration console and management tools are unavailable

 

Managed Server Independence…

By default, managed servers can function independently of the administration server.

Configure Managed Server Independence Mode from the Console

Server -> Configuration -> Tuning -> Advanced Option:

71

  • If the administration server is unavailable at boot time, managed servers search for:
    • xml
    • dat
    • properties(optional)
  • Each managed server looks in its local config directory for config.xml – a replica of the domain’s config.xml

 

Administration Server Backup

  • WLS allows the creation of a backup of the server as follows:
    • Install (if necessary) WLS on backup machine
    • Copy application files to backup machine
    • Copy configuration files to backup machine
    • Restart Administration server on new machine
  • The new Administration server will contact managed servers and inform them that it is running on a new IP address.

 

WebLogic Server Exit Codes

When a server instance stops, it issues an exit code. The value of the exit code provides information about the conditions under which the server process ended. When a server instance under Node Manager Control exits, Node Manager uses the exit code to determine whether or not to restart the server instance. The server exit code can be used by other high-availability agents or scripts to determine what, if any action, to take after a server instance exits. Server exit codes are defined in the following table..

 

Exit Code Value – Less than 0

Meaning: A negative value indicates that the server instance failed during a state transition, and did not terminate in a stable condition. Example: If a Start in Standby command is issued for a server instance whose configuration is invalid, the server instance fails in the transitional STARTING state, and does not achieve the STANDBY state.

Restart Recommendation: Do not attempt to restart the server. Diagnose the problem that caused the server process to exit.

Exit Code Value – 0

Meaning: Indicates that the server process terminated normally, as a result of a shutdown command, either graceful or forced.

Restart Recommendation: None.

Exit Code Value: Greater than 0

Meaning: A positive value indicates that the server instance stopped itself after determining that one or more of its subsystems were unstable. Example: A server instance detects an out of memory condition or stuck threads, and shuts itself down.

Restart Recommendation: The server instance can be restarted.

 

Understanding Server Life Cycle

The series of states through which a WebLogic Server instance can transition is called the server life cycle. At any time, a WebLogic Server instance is in a particular operating state. Commands—such as start, stop, and suspend—cause specific changes to the operational state of a server instance.

 

Diagram of the Server Life Cycle

Figure 5-1 illustrates the server life cycle and the relationships between states and life cycle commands.

72

 

Getting and Using Server State

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

  • Monitor the availability of server instances and the applications they host
  • Perform day-to-day operations tasks, including startup and shutdown procedures
  • Diagnose problems with application services
  • Plan corrective actions, such as migration of services, when a server instance fails or crashes.

 

Get server state as follows:

  • Administration Console—Multiple pages display state information:

On the Summary of Servers page (Environment→Servers), the Servers table displays the current state of each server instance in the current domain.

The SERVER_NAME→Monitoring page displays the state of the currently running server instance, and the date and time it entered the state.

Diagnostics→Log Files, includes timestamped messages for state transitions that have occurred since the server instance was last started.

  • Programmatically—Use the getState() method on the server’s weblogic.management.runtime.ServerRuntimeMBean. For example, to monitor the progress of a long-running graceful shutdown process, issue a getstate inquiry on a separate thread.
  • WebLogic Scripting Tool

 

Understanding Server States in the Server Life Cycle

These sections describe each state in the WebLogic Server life cycle.

 

SHUTDOWN State

In the SHUTDOWN state, a WebLogic Server instance is configured but inactive.

A server instance enters the SHUTDOWN state as result of a Shutdown or Force Shutdown command. In addition, a server instance can kill itself when it detects, as a result of self-health monitoring, that it has become unstable. Only a server instance with its Auto Kill If Failed attribute is true will kill itself when it detects that it is failed.

You can transition a server instance in the SHUTDOWN state to the STARTING state with the Start, Start in Admin, or Start in Standby commands.

 

STARTING State

During the STARTING state, a WebLogic Server instance transitions from SHUTDOWN to STANDBY, as a result of a Start, Start in Admin, or Start in Standby command.

In the STARTING state, a server instance cannot accept any client or administrative requests.

The server instance obtains its configuration data:

An Administration Server retrieves domain configuration data, including the domain security configuration, from its config directory.

A Managed Server contacts the Administration Server for its configuration and security data. If the Managed Server is configured for SSL communications, it uses its own certificate files, key files, and other SSL-related files and contacts the Administration Server for the remaining configuration and security data.

Note: If the Managed Server cannot contact its Administration Server, by default, it starts up in Managed Server Independence mode, using its locally cached copy of the domain config directory.

 

STANDBY State

A server instance in STANDBY does not process any request—its regular Listen Port is closed. The Administration Port is open, and accepts life cycle commands that transition the server instance to either the RUNNING or the SHUTDOWN state. Other Administration requests are not accepted.

Starting a server instance in standby is a method of keeping it available as a “hot” backup, a useful capability in high-availability environments.

The only life cycle command that causes a server instance to enter the STANDBY state and remain in that state is the Start in Standby command. A server instance transitions through the STANDBY state when you issue a Start or a Start in Admin command.

 

Summary:

In this Chapter we discussed:

  • Start and Stop the Administration Server
  • Start and Stop Managed Servers
  • Configure the Managed Servers and Machines
  • Describe Managed Server Independence
  • Understanding Server Life Cycle and WLS Exit Codes

 

Summary
Review Date
Reviewed Item
Managing Server Startup and Shutdown
Author Rating
5

“At TekSlate, we are trying to create high quality tutorials and articles, if you think any information is incorrect or want to add anything to the article, please feel free to get in touch with us at info@tekslate.com, we will update the article in 24 hours.”

0 Responses on Managing Server Startup and Shutdown"

Leave a Message

Your email address will not be published. Required fields are marked *

Site Disclaimer, Copyright © 2016 - All Rights Reserved.