Novell exteNd Code Examples
 
 

INSTALLING THE JAVA PET STORE 1.3_01 APPLICATION

This page describes how to set up and run Java Pet Store 1.3_01 on an exteNd application server (version 4.0 or above).


Setting up the deployment environment

To set up your deployment environment, you:

  • Create the required Pet Store databases
  • Create the database connection pools
  • Add the Pet Store users and groups
  • Add the JMS topics and queues

Novell exteNd Workbench provides support for Cloudscape and MySQL databases. A batch file has been provided for each DBMS to perform all the above tasks in one step. If you want to use a different DBMS, see the Sun Web site at http://java.sun.com/blueprints for information.

  To use the one-step setup process for Cloudscape databases:

The Cloudscape setup file creates databases using the Cloudscape DBMS provided with the application server.

  1. Start the exteNd application server.
  2. Open a DOS prompt.
  3. Change to the Workbench Samples\Petstore1.3_01\setupFiles-cloudscape directory.
  4. Enter the following: SetupPetstore appservername
    For example, if you are running your application server on a local server, enter:
    SetupPetstore localhost
  5. The batch file creates the Cloudscape databases PetStoreDB, OPCDB, and SupplierDB (in the server's db directory); connection pools for the databases; users and groups needed by the application; and JMS topics and queues needed by the application.

  6. If you need to perform one of these steps again later, you can directly invoke one of the following batch files in the same directory:

    • CreateDatabases
    • AddConnectionPools
    • AddUsersGroups
    • InitializeJMS

  To use the one-step setup process for MySQL databases:

MySQL databases are only supported in Novell exteNd Application Server 5.0 or above and require a download from the MySQL website.

  1. Download the database software from the MySQL website at http://www.mysql.com/downloads/mysql-3.23.html. This software runs the database and is used by the setup files to create the database tables.
  2. Download the MySQL Connector/J JDBC driver from the MySQL website at http://www.mysql.com/downloads/api-jdbc.html. This driver is used by the exteNd application server to manipulate data using JDBC.
  3. Define a MYSQL_HOME environment variable that points to the the root of the mysql install directory. For example:
    SET MYSQL_HOME=c:\mysql
  4. Start the exteNd application server using the +cp:a switch to add the MySQL Connector/J JDBC driver to your server classpath. For example, if you placed the JAR in your SILVERSTREAM_HOME\lib directory, start your server as follows:
    silverserver +cp:a %SILVERSTREAM_HOME%\lib\mm.mysql-2.0.13-bin.jar
  5. Open a DOS prompt.
  6. Change to the Workbench Samples\Petstore1.3_01\setupFiles-mysql directory.
  7. Enter the following: SetupPetstore appservername MySQLHostName
    For example, if you are running your application server on a local server and your MySQL database server is running on a machine named DBServerHost, enter:
    SetupPetstore localhost DBServerHost
  8. The batch file creates the MySQL databases PetStoreDB, OPCDB, and SupplierDB (in the mysql install data directory); connection pools for the databases; users and groups needed by the application; and JMS topics and queues needed by the application.

  9. If you need to perform one of these steps again later, you can directly invoke one of the following batch files in the same directory:

    • CreateDatabases
    • AddConnectionPools
    • AddUsersGroups
    • InitializeJMS

Deploying Java Pet Store

To deploy Java Pet Store, you:

Creating the server profile

A server profile provides Workbench with information about the server to which you will deploy one or more Workbench projects.

You need to define only one server profile for the Java Pet Store application. The same server profile is used to deploy all four project EARs.

  To create a server profile:

  1. Start Workbench.
  2. Select Edit>Profiles.
  3. Make sure the Servers tab is selected.
  4. Click New.
  5. Enter the following:

    Setting Value
    Profile name Java Pet Store 1_3_01
    Server type SilverStream 4.0 or higher or Novell 5.0
    Deployment tools directory AppServerInstallDir\bin
    Rapid Deployment directory Leave blank
    Server name The name of your application server (such as localhost)
    Database name The name of your SilverMaster database (such as SilverMaster50)

  6. Click OK.
  7. Click OK to close the Profiles dialog.

Creating the deployment settings

The first time you deploy a project, you need to define its deployment settings. For all subsequent deployments, you can simply follow the deployment steps. For each of the four Pet Store EARs, you need to perform the following steps.

  To create deployment settings:

  1. Start Workbench.
  2. Select File>Open Project.
  3. Navigate to the Workbench Samples\Petstore1.3_01\projects-dbms directory, where dbms is 'cloudscape' for Cloudscape databases and 'mysql' for MySQL databases.
  4. Select the Pet Store project from the table below and click Open.
  5. Select Project>Deployment Settings.
  6. On the Server Profiles tab, choose the Java Pet Store profile you created in the previous section.
  7. Select the Deployment Info tab.
  8. Navigate to the Samples\Petstore1.3_01\projects directory, then select the deployment plan listed in the table for that project file.
  9. Click OK to save the deployment settings.

Project file Deployment plan EAR name SilverCmd Flag (SilverStream 4.0 only)
petstore-ear.spf petstore-depl-plan.xml petstore.ear -l petstore_ear
supplier-ear.spf supplier-depl-plan.xml supplier.ear -l supplier_ear
opc-ear.spf opc-depl-plan.xml opc.ear -l opc_ear
petstoreadmin-ear.spf petstoreadmin-depl-plan.xml petstoreadmin.ear -l petstoreadmin_ear

For example, to create the deployment settings for petstore.ear:

  1. Start Workbench.
  2. Select File>Open Project.
  3. For Cloudscape, navigate to the Workbench Samples\Petstore1.3_01 \projects-cloudscape directory. For MySQL, navigate to the Workbench Samples\Petstore1.3_01 \projects-mysql directory.
  4. Select petstore-ear.spf.
  5. Select Project>Deployment settings.
  6. On the Server Profiles tab, choose the Java Pet Store profile you created in the previous section.
  7. Select the Deployment Info tab.
  8. Specify Samples\Petstore1.3_01\projects-dbms\petstore-depl-plan.xml as the deployment plan.
  9. If deploying against SilverStream 4.0 application server, you need to specify the SilverCmd flag: -l petstore_ear
  10. Click OK to save the deployment settings.

Deployment steps

Once you have completed the steps in Setting up the deployment environment, you can deploy the application.

  To deploy the Java Pet Store EAR files to the exteNd application server:

  1. Make sure the exteNd application server is running.
  2. Open Samples\Petstore1.3_01\projects-dbms\petstore-ear.spf in Workbench.
  3. Select Project>Deploy Archive or click the Deploy icon.
  4. Check the Output Pane for status information about the deployment. The Output Pane displays a Deployment completed message when the archive has been successfully deployed to the server.
  5. Repeat the above steps to deploy supplier.ear, opc.ear, and petstoreadmin.ear.

You can now run the Java Pet Store application.


Running Java Pet Store

  To run Java Pet Store:

  1. Point your browser to appservername, where appservername is the name of the server on which you deployed the application.
  2. Select its associated URL: petstore.

    For example, to run Java Pet Store running on the localhost server, access the URL http://localhost/petstore.