Sun ONE Application Server 7 Getting Started Guide |
Chapter 4
Starting and Stopping the Application ServerSince the application server is not automatically started during installation, you need to start the application server environment and verify that it is running properly before deploying and exercising the sample application. Before starting the application server, this chapter introduces you to the Administrative Domains feature, then gives a brief overview of the processes that make up an application server environment.
This chapter includes the following topics:
Administrative DomainsSun ONE Application Server 7 introduces a feature named Administrative Domains that enables you to define multiple, completely separate application server runtime configurations that reuse the same installation image. Each administrative domain is represented by an administrative server which in turn controls one or more application server instances. The configuration of an administrative domain can reside anywhere on the machine.
Although developers using their own workstations will likely use a single administrative domain for day-to-day development, both shared development servers and operational environments will greatly benefit from using multiple administrative domains. On shared development servers, creation of an administrative domain for each developer provides a compartmentalized area or “sandbox” for each developer on a shared server machine. In operational environments, administrative domains enable systems administrators to define separate secure runtime configurations without requiring multiple installations of the product.
In the following exercises, you will be working with a single administrative domain that has been either preconfigured during installation of the product or configured as a post installation task after the application server has been installed as part of a Solaris 9 installation.
Application Server ProcessesBefore starting the application server, take a few moments to familiarize yourself with the processes that will be running behind the scenes in each administrative domain:
Application Server Daemon
The Application Server Daemon process, appservd, forms the core of the application server runtime. It houses the embedded HTTP Server, ORB, J2EE Containers and supporting subsystems such as the Transaction Manager and Persistence Managers. Each appservd process houses a Java Virtual Machine (JVM).
In each administrative domain, there is an appservd process that houses the administrative server for the domain. This process is referred to as the Administrative Server Instance. The administrative server controls and manages a number of additional appservd processes that represent individual application server instances.
Application Server Watchdog
The application server watchdog processes, appservd-wdog, are native language processes monitor the application server daemon processes. In case of a daemon failure, the companion watchdog restarts the failed application server daemon process. Each application server daemon has a companion watchdog process.
Message Queue Broker
By default, each application server instance includes a companion Sun ONE Message Queue Message Broker process. The message broker process is the core of the JMS of the application server.
Since there is only one application server instance created during installation, initially there is only a single message broker process started during application server startup.
As you define new application server instances, new companion message broker processes are created automatically. After creating an application server instance, you have the option of disabling the companion message broker process to support cases in which your applications either do not use the JMS facilities or use a message service that is not part of the application server (for example, MQSeries).
Message Queue Broker Wrapper
This process is simply a lightweight wrapper around the message broker process. The wrapper process manages restart of the message broker process.
The relationships among these processes is shown in the following diagram:
Figure 4-1 Application Server Processes
Installation Directory StructureDepending on the distribution used to install the application server product on your system, your application server installation may either be installed under a single root directory path or be spread across several root directory paths.
Bundled Installation on Solaris 9
On Solaris, when using the Solaris package-based installation of the product and when installing the application server as part of a Solaris 9 installation, the application server installation is spread across several root directories.
The application server included in a Solaris 9 installation is installed in the following locations:
Since installation of the application server as part of a Solaris 9 installation does not entail initial domain creation, this directory does not exist until the user create an initial domain. As administrative domains are created, they can be placed in any location on the system. This area acts only as the default location in which domains are created.
Package-based Installation on Solaris 8 and 9
By default, when using the Solaris package-based installation of the application server, the installation locations are spread across three directory roots in a similar fashion to the bundled installation case.
- /opt/SUNWappserver7 contains static portion of the installation image. All utilities, executables and libraries that make up the application server reside in this location. Only product patches and upgrades affect this area.
- /etc/opt/SUNWappserver7/config contains installation wide configuration information such as licenses and the master list of administrative domains configured for this installation.
- /var/opt/SUNWappserver7/domains is the default area under which administrative domains are created.
Since installation of the application server as part of a Solaris 9 installation does not entail initial domain creation, this directory does not exist until the user create an initial domain. As administrative domains are created, they can be placed in any location on the system. This area acts only as the default location in which domains are created.
Windows and Evaluation Installations
On Windows, and in the case of installing the evaluation distribution of the application server without Solaris packages, the application server installation is rooted under a single directory path. For example:
In these cases, the config/ and domains/ directories are positioned under the installation directory root.
Conventions for Referring to DirectoriesThis guide uses the following conventions when referring to key locations within an application server installation:
Tools for Starting and Stopping the Application ServerIn the following exercises, “starting” the application server entails starting the administrative server and the initially configured application server instance defined in the preconfigured administrative domain.
To start the application server, you can use any of the following facilities:
- Using the Command-line Interface (UNIX and Windows)
- Using the Administrative Console (UNIX and Windows)
Using the Command-line Interface
On all operating systems, you can use the asadmin command-line interface to start and stop both the entire application server, a specific administrative domain, and individual application server instances. In terms of start and stop operations, the subcommands of asadmin listed in the following table are of interest.
Using start-domain and stop-domain
If the application server is running, use the following command to stop both the administrative server as well as the application server instance of the initially configured domain:
asadmin stop-domain --domain domain1
where domain1 is the name of the administrative domain defined during installation of the application server.
As the command completes, you should observe the following results:
asadmin stop-domain --domain domain1
Instance domain1:server1 stopped
Domain domain1 Stopped.
Note
Windows Platforms: On Windows platforms, a command window appears on your desktop as you start the domain. This command window is a read only representation of the application server instance's event log file content. It will remain on your desktop as long as the associated application server instance is running. As the initially configured server starts, you will see event messages appearing in the second command window. After a few seconds, you will see a message confirming that the server instance has started successfully.
Command Window with Startup Message Does Not Appear? Since some Windows 2000 environments do not properly include the Windows net command in the environment, ensure that your system’s environment has access to this command. If you cannot run the net command at a command prompt, then see the directions in Chapter 3, "Setting Up Your Environment"” for details on correcting this problem.
Likewise, you can start the initially configured administrative domain by executing the following command:
asadmin start-domain --domain domain1
As the command completes, you should observe the following results:
asadmin start-domain --domain domain1
Instance domain1:admin-server started
Instance domain1:server1 started
Domain domain1 Started.
Since there is rarely a reason to start and stop the administrative server repeatedly in day-to-day operations of the application server, you are likely to use the instance-level start and stop subcommands more frequently than the overall start|stop-domain commands. The next section introduces you to starting and stopping individual application server instances from the command line.
Using start-instance and stop-instance
To stop a specific application server instance without relying on the presence of an administrative server, you can use the following command:
asadmin stop-instance server1
where server1 is the name of the application server instance. If your environment contains more than one administrative domain, then you need to specify the administrative domain name when invoking the stop-instance command.
For example:
asadmin stop-instance --domain domain1 server1
To start a specific application server instance in local mode, you can use the following command:
asadmin start-instance server1
If you wish to start or stop an instance on a remote system, you can specify the target administrative server and administrative user name and password on the start-instance and stop-instance commands. Execute either of these subcommands without parameters to see usage information. Alternatively, you can issues the subcommands followed by the --help option to obtain complete usage information.
After launching the processes, you can perform several other checks to determine whether or not the application server has started successfully. Normally, the successful start-up message displayed in the application server's event log window is an indication of a proper startup. However, it is a useful initial exercise to try out several additional methods of checking the status of an application server startup.
In addition to monitoring the server instance event log on the desktop, you can also use either of the following approaches to determine if the server started properly:
Accessing the Server Event Log Files
Although the application server instance event log files are displayed on the desktop by default, the event log of the administrative server is not displayed to the desktop by default. Normally, you won't need to monitor the output of the administrative server. However, if you need to troubleshoot a problem, you can follow these instructions to access the administrative server's event log.
- Using Windows Explorer, navigate to the area in which the administrative event log files are held:
domain_config_dir\domain1\admin-server\logs\
For example:
c:\Sun\AppServer7\domains\domain1\admin-server\logs\
Figure 4-2 Event logs directory
- Double-click server.log to open the file in an editor.
You should find successful server startup at the end of the log file.
Figure 4-3 Log file
If you don't see the successful start-up message, you may have opened the event log file prior to the administrative server completing its startup procedures. Close the log file and open it again to see the very latest event messages.
In day-to-day use of the application server, you will not need to constantly check to see if the administrative server has started successfully. Rather, you will be working primarily with application server instances that are the target of your J2EE development activities.
Although the application server instance event log files are displayed on the desktop by default, it is useful for you to know the location of these event log files.
Navigate to the application server instance's log directory and open the server.log file:
domain_config_dir\domain1\server1\logs\server.log
Figure 4-4 Log file
As you open the application server instance's log file, you should see the same messages that appeared the event log window on the desktop.S
Accessing HTTP Server of Application Server Instance
A simple means of determining whether or not an application server instance has started is to access the instance's HTTP server listener through a web browser. After creation of a new application server instance, you will typically use this approach to quickly determine that the application server has started successfully.
Using a browser, access the following location:
http://hostname:port_number
where port_number is the HTTP server port number specified during installation. The default HTTP server port number is 80, but it may be different based on the ports in use during installation.
If the application server instance is up and running normally, you should see the following default HTTP server welcome page in your browser:
Figure 4-5 HTTP server welcome page
To completely stop the application server, access the Sun ONE Application Server menu item in the Windows program group as described in "Using the Windows Program Group".
In the next section, you will be introduced to the use of Windows services to start the application server.
Using the Administrative Console
As long as the administrative server is running, you can also use the web-based administrative console to start and stop application server instances.
- Start the Administrative Console.
- Sign into the administrative console using the administrative user name and password supplied during product installation.
Once you've authenticated successfully, the initial screen of the administrative console appears:
Figure 4-6 Administrative console
- Select the server1 node to access the start and stop functions.
Figure 4-7 Server 1 node
Note the status of the application server instance. It is either in a “running” or “not running” state.
- Depending on the server instance’s state, click either Start or Stop to start or stop the application server instance.
If you are a UNIX user, proceed to Chapter 5, "Becoming Familiar with the Sample Applications" for a brief introduction to the sample application prior to deploying and exercising it.
If you are using Windows, review the following sections to see how to start the application server using Windows program groups and services.
Using the Windows Program Group
On Windows, the easiest means of starting the entire application server is to access the Windows program group.
- Click the Windows Start button, then select Programs, Sun Microsystems, Sun ONE Application Server 7, Start Application Server.
After selecting Start Application Server, you will first see a command window in which the status of the startup process is displayed.
A second command window also appears on your desktop. This command window is a read only representation of the application server instance's event log file content. It will remain on your desktop as long as the associated application server instance is running. As the initially configured server starts, you will see event messages appearing in the second command window. After a few seconds, you will see a message confirming that the server instance has started successfully:
INFO: CORE3274: successful server startup
Note
Second Window with Startup Message Does Not Appear? Since some Windows 2000 environments do not properly include the Windows net command in the environment, ensure that your system's environment has access to this command. If you cannot run the net command at a command prompt, see the directions in "Setting Up Your Environment" for details about how to correct this problem.
The application server instance command window displays the startup status as shown in the following graphic. Note the server1 designation in the title of the window. This is the name of the application server instance.
Figure 4-8 Application server instance command window
- As the application server is starting up, start the Windows Task Manager to see the processes as they complete their start-up sequence.
You do not need to perform this task in the course of your everyday interaction with the application server. This exercise is presented only to help you understand the behind-the-scenes operation of the application server.
To start and view the Windows Task Manager, perform the following steps:
- Right-click an empty area of the taskbar, then click Task Manager.
You can also start Task Manager by either pressing CTRL+ALT+DELETE and then clicking Task Manager or by pressing CTRL+SHIFT+ESC.
- Once Task Manager starts, select the Processes tab to view all processes running on the system.
- Click on the column title Image Name to sort processes in alphabetical order.
In the following window, note the six processes that make up the initially configured application server environment:
Figure 4-9 Application server processes
Using Windows Services
After installation of the application server, several Windows services are defined to control the startup and shutdown of the administrative server and the initially defined server1 application server instance. This section describes how to use these services to control the application server processes.
- Click the Windows Start button, choose Settings, then Control Panel.
- As the Control Panel is displayed, double-click Administrative Tools.
Figure 4-10 Control panel
- Double-click Services to view the services installed on your system.
The complete list of services defined on your system is displayed.
Figure 4-11 Administrative tools dialog box
- Scroll down to view the Sun Application Server entries.
Figure 4-12 Services window
Note that there are separate Windows services for the administrative server and the initially configured application server instance, server1. As long as the administrative server and application server instance are still running from the previous exercises, the Status column of each service entry should be represented as “Started”.
- As an exercise, start the Windows Task Manager as described in Step a to view the currently executing processes on your system.
- Within the Services window, select the Sun Application Server 7 Admin Server entry, right-click it, and select Stop.
Now monitor the Task Manager Windows to see the underlying processes terminate.
- Follow the same procedure for the application server instance named server1.
As you stop the server1 application server instance, the event log window will disappear from the desktop.
- Once the administrative server and application server instance have been stopped, start them again by using the Windows services: Instead of using the Stop command when right-clicking a service, use the Start command.
You may find it useful initially to monitor the startup of the underlying processes via the Windows Task Manager.
Note that the event log window for the server1 application server instance appears on the desktop as soon as the corresponding service is started.
Proceed to Chapter 5, "Becoming Familiar with the Sample Applications" for a brief introduction to the sample application prior to deploying and exercising it.