C H A P T E R 1 |
Getting Started |
This chapter explains what you must do before starting the Sun ONE Studio 5 Web Application tutorial. The topics covered in this chapter are:
Note - There are several references in this book to the CDShopCart application files. These files include a completed version of the tutorial application, a readme file describing how to run the completed application, and SQL scripts for creating the required database table. These files are compressed into a zip file you can download from the Sun ONE Studio 5 Developer Resources portal at http://forte.sun.com/ffj/documentation/tutorialsandexamples.html |
The following items are required to create and run the tutorial.
You can access general system requirements from the release notes or from the Sun ONE Studio 5 Developer Resources portal's Documentation page at http://forte.sun.com/ffj/documentation/.
This section describes how to start the Sun ONE Studio 5 IDE and Sun ONE Application Server 7 after the software has been installed.
There are several ways to start the Sun ONE Studio 5 IDE. Only one is described here. For more options, see the Sun ONE Studio 5, Standard Edition Getting Started Guide.
Start the Sun ONE Studio 5 IDE by running the program executable.
$ sh s1studio-install-directory/bin/runide.sh |
The s1studio-install-directory variable stands for the IDE's home directory, which is by default $HOME/studio5_se (UNIX standard user) or /opt/studio5_se (UNIX superuser).
Before starting this section, you must have write access to an application server domain. The default domain is created during installation and requires superuser privileges (administrator privileges on Microsoft Windows systems or root privileges in Solaris or Linux environments) to access. If your userid has superuser privileges, you can start the application server using all default settings, as described in the next section. Standard users (without superuser privileges) must use the procedures described in Starting the Admin Server (Standard User).
If you have started the admin server previously, confirm whether it is running. See Confirming Sun ONE Application Server 7 as the Default Server for information. If this is the first time you have started the admin server, start with this section.
1. In the IDE, select the Runtime tab of the Explorer.
The Runtime pane of the Explorer displays the Server Registry node, among other nodes. This node contains subnodes for all the installed web and application servers, and a node showing which servers are the default servers.
2. Select the Server Registry node.
A query window pops up, asking whether you want to start the admin server. This refers to the default domain's admin server, which can only be run by a privileged user.
3. Click OK to start the default admin server.
The IDE starts the default admin server and configures Sun ONE Application Server 7 as the IDE's default application server.
4. Expand the Server Registry node, the Installed Servers node, and the Sun ONE Application Server 7 node.
The Server Registry in the Explorer looks like this:
Now, start the server instance, as described in Starting the Application Server Instance.
If your userid does not have superuser privileges, a superuser must create a domain for you before you start this section. The procedures are described in the Sun ONE Studio 5, Standard Edition Getting Started Guide.
If you have started the IDE previously, created an admin server, and started it, confirm now whether it is running by using the procedures described in Confirming Sun ONE Application Server 7 as the Default Server. If this is the first time you have started the admin server, start with this section.
Before starting the procedures described in this section, you will need values of several properties of your domain. Your administrator can provide these for you. Use the following table to record your values to these properties.:
1. In the IDE, select the Runtime tab of the Explorer.
The Runtime pane of the Explorer displays the Server Registry node, among other nodes. This node contains subnodes for all the installed web and application servers, and a node showing which servers are the default servers.
2. Select the Server Registry node.
A query window pops up, asking whether you want to start the admin server. This refers to the admin server of the default domain, which can only be run by a privileged user.
If you click OK, this action creates and starts an admin server that you cannot use. Click Cancel.
3. Add your admin server to the IDE.
a. Expand the Server Registry node and the Installed Servers node.
b. Right-click the Sun ONE Application Server 7 node and choose Add Admin Server.
The Add Admin Server dialog box is displayed.
c. Type in your values from TABLE 1-1 and click OK.
If an error message appears, stating that the IDE could not locate the admin server, but will start it if it is local, click OK to close the error window. A progress window appears, showing the admin server process starting up.
A new admin server node is generated in the Explorer. In the following screen shot, the new admin server's host is localhost and port number is 4850.
4. Create an application server instance.
a. Right-click the new admin server node and choose Create a Server Instance.
The Enter Server Instance Values dialog box is displayed.
b. Type in a name and port number.
For example, you could type MyServer and 4855.
This action starts the admin server, which you can verify by messages in the output window and status bar. The new server instance is created in the IDE.
5. Set the default application and web server by right-clicking the new server instance and choosing Set As Default.
6. Expand the Default Servers node to verify this action.
The default servers for J2EE applications and web tier applications show the new server as the default.
Now start the server instance, as described in the next section.
When you are test deploying and deploying applications during development, the IDE starts the application server instance automatically as long as the admin server is running. In this section, you start the application server instance manually in order to perform some operations described later in this chapter.
All users start the server instance as follows:
1. Right-click the application server node and choose Status.
Note - If this node is not displayed, select the admin server instance node and choose Refresh. |
The Sun ONE Application Server Instance Status dialog box is displayed, as shown (your instance label may be different).
2. Click the Start Server button.
(If the dialog box has a Stop Server button, the server is already running.)
On Microsoft Windows systems, a command window appears, displaying progress messages.
The server is started when the Server Instance Status window displays Status: Running.
3. Click Close on the instance status dialog box.
Now, proceed to Creating the Tutorial Database Table.
If you have started Sun ONE Application Server 7 before, this is how you confirm that it is still the default server:
1. In the IDE, select the Runtime tab of the Explorer.
2. Expand the Server Registry node and its Default Servers subnode.
If the Web Tier Applications node's label is server-instance(server-hostname:server-port-number), as shown, then Sun ONE Application Server 7 is the default web server. Go to the next section. Otherwise, continue with the next step.
3. Find your web server instance under the Installed Servers node, right-click it, and choose Set As Default.
Your server is set as the default server for J2EE and Web Tier applications.
Before you can start the CDShopCart tutorial, you must create and install a database table in the PointBase Network Server database. Use the SQL script in Appendix B to create these tables. A script file, CDCatalog_pb.sql, is also available within the cdshop.zip file for the CDShopCart tutorial, available from:
http://forte.sun.com/ffj/documentation/tutorialsandexamples.html
To install the tutorial table in a PointBase database:
1. Start the PointBase Server from the IDE by choosing Tools PointBase Network Server
Start Server.
The PointBase Network Server window is displayed. Minimize the window.
2. Start the PointBase Console from the IDE by choosing Tools PointBase Network Server
Start Console.
The Connect To Database dialog box appears, showing values for the PointBase driver to the default sample database.
3. Change the word sample at the end of the URL field to cdshopcart, as shown.
4. Set the Create New Database option and click OK.
The PointBase Console is displayed. Wait until the status message ending in "Ready" is displayed before proceeding.
5. Copy the PointBase script from Script for a PointBase Database and paste it into the SQL entry window of the Console.
Alternatively, if you have the CDCatalog_pb.sql file from the tutorial source zip file, do this:
a. Choose File Open to display the file browser dialog box.
b. Use the file browser to locate the CDCatalog_pb.sql file and click Open.
The message window confirms that the script was executed. (Ignore the initial message beginning "Cannot find the table..." This is a harmless error and appears because there is a DROP statement for a table that has not yet been created yet. This DROP statement will be useful in the future if you want to rerun the script to initialize the table.)
7. Test that you have created the table by clearing the SQL entry window (Window Clear Input) and typing:
select * from CD; |
Your console should display the CD table.
Note - If your display does not look like this table, choose Window |
9. Close the PointBase Console window.
The CDCatalog script creates the database schema shown in TABLE 1-2.
The CD table is populated with the records shown in TABLE 1-3.
Now you are ready to start the tutorial application. Either continue to Chapter 2 to get an overview of the application you will build, or go directly to Chapter 3 and start building it.
Copyright © 2003, Sun Microsystems, Inc. All rights reserved.