BEA Logo BEA WebLogic Server Release 6.1

  Corporate Info  |  News  |  Solutions  |  Products  |  Partners  |  Services  |  Events  |  Download  |  How To Buy

   BEA WebLogic Server Administration Guide:   Previous topic   |   Next topic   |   Contents   |  Index

 

Starting and Stopping WebLogic Servers

 

This section discusses the following topics:

WebLogic Administration Server and WebLogic Managed Servers

A WebLogic domain may consist of one or more WebLogic Servers. One (and no more than one) of these WebLogic Servers must be the Administration Server for the domain. Additional WebLogic Servers in the domain are managed servers. The same executable may be started as either a WebLogic Administration Server or as a WebLogic Managed Server.

Being the Administration Server is the default role for a WebLogic Server. Therefore, if there is only one WebLogic Server in a domain, that server is the Administration Server. In a multi-server domain, a WebLogic Server becomes a Managed Server only if it is instructed to obtain its configuration from a running Administration Server when started.

The Administration Server controls access to the configuration for a WebLogic domain and provides other management services such as monitoring and log message browsing. The Administration Server serves up the Administration Console which provides user access to the management services offered by the Administration Server.

When a WebLogic Managed Server is started, it obtains its configuration from the Administration Server. For this reason, booting a multi-server WebLogic domain is a two-step procedure: First you start the Administration Server, and then you start the Managed Servers.

Note: The Managed Servers must be the same WebLogic version as the Administration Server.

Startup Error Messages

When a WebLogic Server is starting, the normal logging subsystem is not yet available for logging. Accordingly, any errors encountered during startup are logged to stdout and to a special startup log, servername-startup.log (where servername is the name of the server). If startup is successful, the last message in this log points to the location of the local server log file where normal logging occurs. For more information on the WebLogic Server logging subsystem, see Using Log Messages to Manage WebLogic Servers.

Starting the WebLogic Administration Server

There are several ways in which the WebLogic Administration Server can be started:

Use of Passwords When Starting the WebLogic Server

During installation you are asked to specify a password that will be required when the server is started. If you use start scripts to start an Administration Server or a Managed Server, you can include the password as a command-line argument (See Starting the WebLogic Administration Server from the Command Line.) If you start the server using a script without the password specified as a command-line argument, you will be prompted to enter the password if there is no password.ini file.

Starting the WebLogic Administration Server from the Start Menu

If you installed WebLogic Server on Windows with the BEA Installation program, you can use the WebLogic Server shortcut on the Windows Start menu to start the WebLogic Administration Server. Select:

Start-->Programs-->BEA WebLogic E-Business Platform-->Weblogic Server Version-->Start Default Server

where version is the WebLogic Server software version number.

Invoking the WebLogic Server from the Start menu executes the start script startWeblogic.cmd (which is located in install_dir/config/domain_name where domain_name is the name of the domain and install_dir is the directory where you installed the WebLogic Server software).

Starting and Stopping the WebLogic Server as a Windows Service

When installed as a Windows service, the WebLogic Server starts automatically when you boot the Windows computer. The WebLogic Server is started by executing the Windows start script startWeblogic.cmd. A WebLogic Server started this way is started as an Administration Server. See Starting the WebLogic Administration Server from the Command Line.

To run the WebLogic Server as a Windows service, you must have installed it as such. For information on installing and removing the WebLogic Server as a Windows service, see Setting up the WebLogic Server as a Windows Service.

You can also stop and start the WebLogic Server easily from the Service Control Panel.

  1. Select Start-->Settings-->Control Panel.

  2. Double-click the Services Control Panel to open it.

  3. In the Services Control Panel, scroll to the end to find WebLogic Server. If WebLogic is Started, you will have the option to Stop it when you select it, by clicking the Stop button to the right. If WebLogic is Stopped, the Start button will be available.

You can make the Windows service Automatic, Manual, or Disabled by clicking the Startup button and selecting a mode.

Starting the WebLogic Administration Server from the Command Line

The WebLogic Server is a Java class file, and like any Java application, you can start it with the java command. The arguments needed to start the WebLogic Server from the command line can be quite lengthy and typing it out whenever you need to start the server can be tedious. To make sure that your startup commands are accurate, BEA Systems recommends that you incorporate the command into a script that you can use whenever you want to start a WebLogic Server.

The following arguments are required when starting the WebLogic Administration Server from the java command line:

Setting the Classpath Option

The following must be included as arguments to the -classpath option on the java command line:

where weblogic is the directory where you installed WebLogic Server.

Starting the Administration Server Using a Script

Sample scripts are provided with the WebLogic distribution that you can use to start WebLogic Servers. You will need to modify these scripts to fit your environment and applications. Separate scripts are provided for starting the Administration Server and the Managed Server. The scripts for starting the Administration Server are called startWebLogic.sh (UNIX) and startWeblogic.cmd (Windows). These scripts are located in the configuration subdirectory for your domain.

To use the supplied scripts:

Restarting the Administration Server when Managed Servers are Running

For a typical production system it is recommended that the applications containing your critical business logic be deployed on Managed Servers. In such a scenario, the role of the Administration Server is that of configuring and monitoring the Managed Servers. If the Administration Server should become unavailable in such a configuration, the applications running on the Managed Servers can continue to process client requests.

When the Administration Server is started, it makes a copy of the configuration file that was used to boot the active domain. This is saved in the file

install_dir/config/domain_name/config.xml.booted

where install_dir is the directory where you installed the WebLogic Server software and domain_name is the name of the domain. The Administration Server creates the config.xml.booted file only after it has successfully completed its startup sequence and is ready to process requests.

You should make a copy of this file so that you have a working configuration file that you can revert to if you need to back out of changes made to the active configuration from the Administration Console.

If the Administration Server goes down while Managed Servers continue to run, you do not need to restart the Managed Servers to recover management of the domain. The procedure for recovering management of an active domain depends upon whether you can restart the Administration Server on the same machine it was running on when the domain was started.

Restarting the Administration Server on the Same Machine

If you restart the WebLogic Administration Server while Managed Servers continue to run, the Administration Server can detect the presence of the running Managed Servers if you instruct the Administration Server to perform a discovery. To instruct the Administration Server to do a discovery of Managed Servers, enter the following argument on the command line when starting the Administration Server:

-Dweblogic.management.discover=true

The default value of this attribute is false. The configuration directory for the domain contains a file running-managed-servers.xml which is a list of the Managed Servers that the Administration Server knows about. When the Administration Server is instructed to perform discovery upon startup, it uses this list to check for the presence of running Managed Servers.

Restart of the Administration Server does not update the runtime configuration of the Managed Servers to take account of any changes made to attributes that can only be configured statically. WebLogic Servers must be restarted to take account of changes to static configuration attributes. Discovery of the Managed Servers does enable the Administration Server to monitor the Managed Servers or make runtime changes in attributes that can be configured dynamically.

Restarting the Administration Server on Another Machine

If a machine crash prevents you from restarting the Administration Server on the same machine, you can recover management of the running Managed Servers as follows:

  1. Assign to another computer the same host name as the former Administration Server machine.

  2. Install the WebLogic Server software on the new administration machine (if this has not already been done).

  3. The /config directory (the configuration repository) used to start the Administration Server on the machine being replaced needs to be made available to the new machine. The /config directory could be copied from backup media or made available via NFS mount, for example. This includes the configuration file (config.xml) used to boot the active domain as well as applications and components installed in the /applications directory for that domain.

  4. Restart the Administration Server on the new machine with the addition of the following argument on the command line:

    -Dweblogic.management.discover=true

    This argument will force the Administration Server to detect the presence of the Managed Servers that are running.

Adding a WebLogic Managed Server to the Domain

Before you can run a WebLogic Server as a managed server, you must first create an entry for that server in the configuration for the domain. To do this, do the following:

  1. Start the Administration Server for the domain.

  2. Invoke the Administration Console by pointing your browser at http://hostname:port/console, where hostname is the name of the machine where the Administration Server is running and port is the listen port number that you have configured for the Administration Server (default is 7001).

  3. Create an entry for the server machine (Machines-->Create a new machine) (if it is different than the Administration Server machine) and the new server (Servers-->Create a new server).

For more information on configuring servers, see Configuring WebLogic Servers and Clusters.

Starting a WebLogic Managed Server

Once you have added WebLogic Managed Servers to your configuration (see Adding a WebLogic Managed Server to the Domain), you can start the Managed Servers from the java command line. The command to start the WebLogic Server can be either typed in a command shell manually or it can be placed in a script to avoid retyping the command each time the server is started. For information on the sample scripts provided see Starting the WebLogic Managed Servers Using Scripts.

The main way in which the startup parameters for a Managed Server differ from an Administration Server is that you need to provide an argument that identifies the location of the Administration Server from which the Managed Server requests its configuration. A WebLogic Server started without this parameter runs as an Administration Server.

The following are required when starting a WebLogic Managed Server:

Starting the WebLogic Managed Servers Using Scripts

Sample scripts are provided with the WebLogic distribution that you can use to start WebLogic Servers. You will need to modify these scripts to fit your environment and applications. Separate scripts are provided for starting the Administration Server and the Managed Server. The scripts to start Managed Servers are called startManagedWebLogic.sh (UNIX) and startManagedWebLogic.cmd (Windows). These scripts are located in the configuration subdirectory for your domain.

To use the supplied scripts:

There are two ways to start the Managed Server using the script:

Migrating from Earlier Versions of WebLogic Server

If you have WebLogic Server startup scripts that you used with a previous release of the product, you will need to modify them to work with this release. The following are the main changes from previous releases:

Stopping WebLogic Servers from the Administration Console

To shutdown an individual WebLogic Server:

Shutting Down a Server from the Command Line

You can also shut down a WebLogic Server from the command line with the following command:

java weblogic.Admin -url host:port SHUTDOWN -username adminname -password password

where:

host is the name or IP address of the machine where the WebLogic Server is running.

port is the WebLogic Server's listen port (default is 7001).

adminname designates a user that has administrator privileges for the target WebLogic Server. Default is system.

password is the password for adminname.

Setting up the WebLogic Server as a Windows Service

You can run the WebLogic Server as a Windows service. When installed as a Windows service, the WebLogic Server starts automatically when you boot the Windows computer. A WebLogic Server is started this way by invoking the start script startWeblogic.cmd. Whether the WebLogic Server is started as an Administration Server or as a Managed Server depends upon the parameters in the java command invoking the WebLogic Server. See Starting a WebLogic Managed Server and Starting the WebLogic Administration Server from the Command Line.

To setup the WebLogic Server to run as a Windows service or to reconfigure it so it is no longer a Windows service, you must have administrator-level privileges. To install the WebLogic Server as a Windows service, do the following:

  1. Navigate to the weblogic\config\mydomain directory (where weblogic is the directory where WebLogic Server was installed and mydomain is the subdirectory with your domain's configuration).

  2. Execute the script installNTService.cmd.

Removing WebLogic Server as a Windows Service

To remove the WebLogic Server as a Windows service, do the following:

  1. Navigate to the weblogic\config\mydomain directory (where weblogic is the directory where WebLogic Server was installed and mydomain is the subdirectory with your domain's configuration).

  2. Execute the script uninstallNTService.cmd.

You can also uninstall the WebLogic Server as a Windows service from the Windows Start menu.

Changing Passwords for a Server Installed as a Windows Service

If you install the Default Server as a Windows service, the system password that you entered during installation of the WebLogic software is used when creating the service. If this password is later changed, you must do the following:

  1. Uninstall the WebLogic Server as a Windows service using the uninstallNTService.cmd script (located in the directory install_dir/config/domain_name where install_dir is the directory where you installed the product).

  2. The installNTservice.cmd script contains the following command:

    rem *** Install the service
    "C:\bea\wlserver6.0\bin\beasvc" -install -svcname:myserver -javahome:"C:\bea\jdk130" -execdir:"C:\bea\wlserver6.0" -extrapath:"C\bea\wlserver6.0\bin" -cmdline:
    %CMDLINE%

    You must append the following to the command:

    -password:"your_password"

    where your_password is the new password.

  3. Execute the modified installNTservice.cmd script. This will create a new service with the updated password.

The WebLogic Windows Service Progam (beasvc.exe)

The scripts for installing and removing a WebLogic Server as a Windows service invoke the WebLogic Windows Service program, beasvc.exe. Multiple instances of WebLogic Server can be installed or removed as a Windows service using beasvc.exe.

All configurations for multiple services are stored in the Windows Registry using a different service name and under a server-specific hive at:

HKEY_LOCAL_MACHINE\SYSTEM\Current\ControlSet\Services

When you start the service, the Windows registry entries are picked up and the JVM is initialized and started. Since each service that is installed is independent of the others, you can install multiple instances of WebLogic Server to run as a Windows service, provided that each service is given a unique name.

The following options are available with beasvc.exe:

-install

Install the specified service.

-remove

Remove the specified service.

-svcname: service_name

The user-specified name of the service to be installed or removed.

-cmdline: java_cmdline_parameters

The java command-line parameters to be used when starting the WebLogic Server as a Windows service.

-javahome: java_directory

Root directory of the Java installation. The start command will be formed by appending \bin\java to java_directory.

-execdir: base_dir

Directory where this startup command will be executed.

-extrapath: additional_env_settings

Additional path settings that will be prepended to the path applicable to this command execution.

-help

Prints out the usage for the beasvc.exe command.

Win32 systems have a 2K limitation on the length of the command line. If the classpath setting for the Windows service startup is very long, the 2K limitation could be exceeded. With the 1.2 or later version of the Sun Microsystems JVM, you can specify a file that contains the classpath using the @ option. You could use this option with beasvc.exe as in the following example:

beasvc -install -svcname:myservice -classpath:@C:\temp\myclasspath.txt

Registering Startup and Shutdown Classes

WebLogic provides a mechanism for performing tasks whenever a WebLogic Server starts up or gracefully shuts down. A startup class is a Java program that is automatically loaded and executed when a WebLogic Server is started or restarted. Startup classes are loaded and executed only after all other server initialization tasks have completed.

Shutdown classes work the same way as startup classes. A shutdown class is automatically loaded and executed when the WebLogic Server is shut down either from the Administration Console or using the weblogic.admin shutdown command.

In order for your WebLogic Servers to use startup or shutdown classes, it is necessary to register these classes, which you can do from the Administration Console.

You can register a startup or shutdown class by doing the following:

  1. Access the Startup & Shutdown table from the domain tree (in the left pane) in the Administration Console. This table provides options for creating entries for shutdown or startup classes in the domain configuration.

  2. Provide the class name and necessary arguments, if any, on the Configuration tab page for the startup or shutdown class you are adding.

See the Administration Console online help for more information on:

 

Back to Top