J2EE Blueprints

JavaTM Pet Store Demo

 installation and configuration
   installing the javaTM pet store on unix systems
 
This document describes how to install and configure the Java Pet Store sample application on Unix systems. Please be sure to follow the instructions closely.

  1. Install Java Standard and Enterprise SDKs.
    If you don't already have them, download and install each of the following:

  2. Configure Java home directory environment variable.
    In your shell startup file (.profile for Bourne/bash shells, .cshrc for csh and tcsh), set JAVA_HOME to the base directory where you installed the J2SE SDK. For example, if you installed the J2SE SDK in ~/jdk1.3, set JAVA_HOME to ~/jdk1.3. For Bourne shell and bash, the syntax would be
    JAVA_HOME=$HOME/jdk1.3
    export JAVA_HOME
    For csh and tcsh, the syntax would be
    setenv JAVA_HOME ~/jdk1.3

  3. Configure J2EE home directory environment variable.
    In your shell startup file, set the variable J2EE_HOME to the base directory of the J2EE SDK. For example, if you installed the J2EE SDK at ~/j2sdkee1.2.1, set J2EE_HOME to ~/j2sdkee1.2.1. For Bourne shell and bash, the syntax would be
    J2EE_HOME=$HOME/j2sdkee1.2.1
    export J2EE_HOME
    For csh and tcsh, the syntax would be
    setenv J2EE_HOME ~/j2sdkee1.2.1
    After setting these environment variables, be sure to set them in your shell by either sourcing the startup file, or by logging out and logging in again.
  4. Start the Cloudscape database server.
    This command will run the Cloudscape server, so your command prompt will not return. You'll want to run this command either in a separate window or in the background. Change directory to $J2EE_HOME/bin and run:
    cloudscape -start
  5. Unzip the Java Pet Store
    Use your favorite ZIP decompression tool to unzip the Java Pet Store file petstore.zip to a convenient directory. Everything in the zip file will decompress to a directory called jps1.1, referenced in subsequent steps.
  6. Create the Java Pet Store database.
    The top-level directory of the Java Pet Store is jps1.1. Change directory to jps1.1/database.sql and run
    startIJ cloudscape.sql
    You will probably see some error messages that look like:
    ERROR 42X05: Table 'LINEITEM' does not exist.
    These messages can safely be ignored: they're simply table drop statements for future invocations of this script. Since no tables exist in an empty database, they fail (harmlessly) the first time this script is run.
  7. Configure the J2EE SDK to use the Java TM Pet Store database.
    Edit the file $J2EE_HOME/config/default.properties, and append to the jdbc.datasources property the following text:

    |jdbc/EstoreDB|jdbc:cloudscape:rmi:CloudscapeDB;create=true| jdbc/InventoryDB|jdbc:cloudscape:rmi:CloudscapeDB;create=true.

    Be sure the variable and its value appear on a single line, not broken in two pieces as shown here.

  8. Enable creation of new Java Pet Store users.
    Edit the file $J2EE_HOME/lib/security/server.policy, and append the following line to the very last grant section of the file:

    permission java.io.FilePermission "<<ALL FILES>>", "read,write,delete";

  9. Start the J2EE server.
    This command runs the J2EE server, so your command prompt will not return. You'll want to run this command either in a separate window or in the background. Change directory to $J2EE_HOME/bin and run:
    j2ee
    For copious debugging output, run:
    j2ee -verbose
  10. Start the deploy tool.
    Still in the $J2EE_HOME/bin directory, run:
    deploytool
  11. Deploy the application.
    Click on the File menu, click on Open Application... menu item, and select the file jps1.1/petstore.ear. Then, click on Tools menu, click Deploy Application, and go through the dialog boxes to complete the deployment. You can choose to use the default values, if you do not want to change any settings.
  12. Visit the Java Pet Store
    Open your Web browser to the site:
    http://localhost:8000/estore/index.html