![]() |
![]() |
|
Starting and Stopping WebLogic Servers
This section discusses the following topics:
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:
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.
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:
StartPrograms
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.
Settings
Control Panel.
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:
For example, you may want to start the server with a default allocation of 64 megabytes of Java heap memory to the WebLogic Server. To do so, you can start the server with the java -ms64m and -mx64m options.
These values assigned to these parameters can dramatically affect the performance of your WebLogic Server and are provided here only as general defaults. In a production environment you should carefully consider the correct memory heap size to use for your applications and environment.
The minimum content for this option is described under Setting the Classpath Option.
The domain configuration specifies configuration by server name. To specify the name of the server on the command line, use the following argument:
-Dweblogic.Name=servername
The default value is myserver.
The default user is system and the required password is the password specified during installation. To enter the password, include the following argument:
-Dweblogic.management.password=password
The WebLogic root directory contains the security resources for the domain and the Configuration Repository (a directory named \config). You can specify the location of the root directory on the command line with the following argument:
-Dweblogic.RootDirectory=path
where path is the path to the root directory. If you do not specify this attribute on the command line, the current directory is used to set the runtime value of this attribute.
-Dbea.home=root_install_dir
where root_install_dir is the root directory under which you installed the BEA WebLogic Server software.
-Dweblogic.pkpassword=pkpassword
where pkpassword is the private key password.
Password-protected private keys are generated when the Private Key Password field is specified in the Certificate Request Generator servlet. For more information, see Managing Security.
-Dweblogic.Domain=domain_name
where domain_name is the name of the domain. This will also be the subdirectory which has the configuration file that will be used to boot the domain.
The configuration repository consists of the domains under the /config directory. The configuration repository may contain a variety of possible domain configurations. Each such domain is located under a separate subdirectory, with the subdirectory name being the name of that domain. When you specify domain_name you are thus specifying this subdirectory name. The subdirectory thus specified contains the XML configuration file (config.xml) and the security resources for that domain (see example below). The file config.xml specifies the configuration for that domain.
The domain configuration with which the Administration Server is started becomes the active domain. Only one domain can be active.
-Dweblogic.attribute=value
The following must be included as arguments to the -classpath option on the java command line:
/weblogic/samples/eval/cloudscape/lib/cloudscape.jar
/weblogic/lib/poolorb.jar
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.
chmod +x startAdminWebLogic.sh
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:
-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:
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:
For example, you may want to start the server with a default allocation of 64 megabytes of Java heap memory to the WebLogic Server. To do so, you can start the server with the java -ms64m and -mx64m options.
These values assigned to these parameters can dramatically affect the performance of your WebLogic Server and are provided here only as general defaults. In a production environment you should carefully consider the correct memory heap size to use for your applications and environment.
The minimum content for this option is described under Setting the Classpath Option.
When a WebLogic Managed Server requests its configuration information from the Administration Server, it identifies itself to the Administration Server by server name. This enables the Administration Server to respond with the appropriate configuration for that WebLogic Server. For this reason, you must also set the server name when starting a managed server. This can be specified by adding the following argument to the command line when starting the WebLogic Managed Server:
-Dweblogic.Name=servername
Only the system user can start a Managed Server. To specify the password for the system user, you can include the following argument:
-Dweblogic.management.password=password
For information about use of passwords, see Use of Passwords When Starting the WebLogic Server.
Note: Because system is the default value for the -Dweblogic.management.username argument, you do not need to specify it when starting a Managed Server.
-Dbea.home=root_install_dir
where root_install_dir is the root directory under which you installed the BEA WebLogic Server software.
-Dweblogic.pkpassword=pkpassword
where pkpassword is the SLL private key password.
When starting a managed server, it is necessary to specify the host name and listen port of the Administration Server from which the managed server is to request its configuration. This can be specified by adding the following argument to the command line when starting the managed server:
-Dweblogic.management.server=host:port
or
-Dweblogic.management.server=http://host:port
where host is the name or IP address of the machine where the Administration Server is running and port is the Administration Server's listen port. By default the Administration Server's listen port is 7001.
If you are using Secure Socket Layer (SSL) for communication with the Administration Server, the Administration Server must be specified as:
-Dweblogic.management.server=https://host:port
To use SSL protocol in communication between the Managed Servers and the Administration Server, you need to enable SSL on the Administration Server. For details on how to set this up, see Managing Security.
Note: Any WebLogic Server that is started without specifying the location of the Administration Server is started as an Administration Server.
Note: Because the Managed Server receives its configuration from the Administration Server, the Administration Server specified must be in the same domain as the Managed Server.
-Dweblogic.attribute=value
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.
chmod +x startManagedWebLogic.sh
There are two ways to start the Managed Server using the script:
set SERVER_NAME=bigguy
set ADMIN_URL=peach:7001
startManagedWebLogic
startManagedWebLogic server_name admin:url
where server_name is the name of the Managed Server you are starting and admin_url is either http://host:port or https://host:port where host is the host name (or IP address) of the Administration Server and port is the port number for the Administration 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:
Previous releases of WebLogic Server had two separate Java classpath settings on the command line:
The WebLogic classpath property was used to facilitate dynamic class loading. In this release, the WebLogic classpath property has been eliminated and the Java system classpath setting has changed. Scripts used with previous releases will need to be modified accordingly. In this release, dynamic loading of classes needed for Java 2 applications is the responsibility of those applications, and specifying the location of the compiled classes is accomplished via the Extensible Markup Language (XML) descriptors in the files comprising the application.
See Setting the Classpath Option for information on setting the Java system classpath.
To shutdown an individual WebLogic Server:
General tab page, select the Shutdown this server link.
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
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:
Removing WebLogic Server as a Windows Service
To remove the WebLogic Server as a Windows service, do the following:
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:
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.
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:
-cmdline: java_cmdline_parameters
-extrapath: additional_env_settings
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:
See the Administration Console online help for more information on:
|
Copyright © 2000 BEA Systems, Inc. All rights reserved.
|