JavaTM PetStore Setup on Windows NT/2000

This article describes the setup of the various components necessary to run the Java PetStore application on Windows NT/2000 using an Oracle Rdb database as the data source.

  1. Download and install J2SE
  2. Download and install Oracle9iAS
  3. Install Oracle9iAS Container for J2EE (OC4J)
  4. Download and install an Oracle-modified version of Java PetStore
  5. Create a PetStore Rdb Database
  6. Hook the Java PetStore Application to the PetStore Rdb Database
  7. Run the PetStore

Assumptions

Throughout this document, references are made to various computer systems and directories. Most of the values used are for documentation purposes only and MUST be changed to fit your environment. These environment-dependent values are bolded throughout this article.

Specifically, the following assumptions are made:

  • A Windows NT/2000 system will be used to run Oracle9iAS and the JavaTM PetStore application. mypc is used as the system name.

  • The Oracle Home name used is 9iAS and the directory used is C:\Oracle\9iASCore\.

  • An OpenVMS system will be used to house the Oracle Rdb 7.1 repository. MYAXP is used as the system name. PETRDB is used as the database SID.

  • The OCI Listener on the OpenVMS system has been defined and is assigned to port 1527. NOTE: This port number may likely be different on your system! If so, use the port number already set up for your system.

  • JavaTM 2 SDK, Standard Edition (J2SE) version 1.3.1-01 will be used and installed into the default directory of C:\jdk1.3.1_01\. As of this write up, Oracle9iAS requires a 1.3.* version and has NOT been certified with 1.4 or higher.

Step 1: Download and install J2SE

The first thing to do is download and install the basic Java foundation from Sun Microsystems. This includes the JavaTM 2 SDK, Standard Edition (J2SE).

  1. From the JavaTM 2 SDK, Standard Edition webpage, follow the link for the SDK, select the Microsoft Windows platform, read through and accept the terms and conditions of their license, and finally FTP download the installation kit into a temporary folder.

  2. After the file has downloaded successfully, find the file in the temporary folder and double click on it to run it. This will run the setup program and will install the J2SE SDK on the system. For any questions asked during the installation, accept the defaults.

  3. Alter the user or system environment variable PATH to included the "bin" subdirectory in the JDK directory created by this install. For this write-up, the user environment variable PATH was added with the value of C:\jdk1.3.1_01\bin;%path%. This may be accomplished via the "Environment Variables" button off of the "Advanced" tab in the "Systems" application off of the "Control Panel".

Full documentation is provided by Sun from their Java Developer Connection Documentation and Training webpage.

Step 2: Download and install Oracle9iAS

The next major step is to download and install Oracle9iAS. For the PetStore demo, all that is needed is provided in the Oracle9iAS Core kit. This kit includes the Oracle HTTP Server, the Oracle9iAS Web Cache, the Oracle9iAS Containers for J2EE (OC4J), and the DB Client. Version 1.0.2.2 was used for the PetStore demo linked from this page.

  1. From the Oracle Technology Network (OTN) Oracle9iAS software webpage, find and click on the link for the Windows NT version of Oracle9iAS Core, read through and accept the terms and conditions of the license, and finally download the zip file into a temporary folder.

  2. After the file has downloaded successfully, find the file in the temporary folder and double click on it to unzip it.

  3. Run the Oracle Universal installer to install the Oracle9iAS Core product. For the Oracle home name and directory, enter unique names such as "9iAS" and "C:\Oracle\9iASCore\" respectively.

  4. At the end of the installation, it is not necessary to run the net configuration tool at this point in time.

  5. After a successfuly installation, the Oracle HTTP Server should be accessible from url http://localhost/ or http://mypc/. Please note that, by default, it will be autostarted every time the system reboots.

Full documentation on installing the Oracle9iAS Core may be found at the Oracle Technology Network Oracle9iAS webpage.

Step 3: Install Oracle9iAS Container for J2EE (OC4J)

The Oracle9iAS Container for J2EE (OC4J) is provided with the Core kit but is not installed. To install:

  1. Unzip C:\Oracle\9iASCore\j2ee_containers\oc4j.zip into C:\Oracle\9iASCore\ which will create a j2ee subdirectory.

  2. Install OC4J using the following commands in a MS-Command window. Modify mypassword accordingly.
         C:\> cd c:\Oracle\9iASCore\j2ee\home\
         C:\Oracle\9iASCore\j2ee\home> java -jar orion.jar -install
           Enter an admin password to use: mypassword
           Confirm admin password: mypassword
           Installation done
    

    Note: The username for the admin account defaults to admin.

  3. Start up OC4J using the following commands in a MS-Command window.
         C:\> cd c:\Oracle\9iASCore\j2ee\home\
         C:\Oracle\9iASCore\j2ee\home> java -jar orion.jar
           Auto-deploying file:/C:/Oracle/9iASCore/j2ee/home/default-web-app/ (New server
           version detected)...
           Oracle9iAS (1.0.2.2.1) Containers for J2EE initialized
    

Note: To gracefully shutdown OC4J, use the following commands in a separate MS-Command window.

     C:\> cd c:\Oracle\9iASCore\j2ee\home\
     C:\Oracle\9iASCore\j2ee\home> java -jar admin.jar ormi://localhost/ admin mypassword
       -shutdown

More information on Oracle9iAS OC4J may be found at the Oracle9iAS Containers for J2EE webpage.

Step 4: Download and install Oracle-modified version of Java PetStore

Oracle provides a pre-built version of Java Petstore1.1.2 containing the minor changes necessary to use Oracle as the data access object. This pre-built demo is same as the pet store demo that you can download from Sun except that this demo includes necessary changes to work against an Oracle database.

  1. Download the Java PetStore zip file from the Oracle Technology Network OC4J Sample Code webpage into a temporary folder.

  2. Unzip the file into C:\Oracle\9iASCore\j2ee\home\applications.

  3. Edit C:\Oracle\9iASCore\j2ee\home\config\server.xml and add the following line between the existing <application> and </application> tags.
    <application name="petstore" path="../applications/petstore.ear" />
    

    Note: The above line may already exist in the server.xml file. If it does, simply verify that it does not reside within a <!-- --> comment tag.

  4. Edit C:\Oracle\9iASCore\j2ee\home\config\default-web-site.xml and add the following line between the existing <web-site> and </web-site> tags.
    <web-app application="petstore" name="petstore" root="/technology/estore" />
    

    Note: The above line may already exist in the default-web-site.xml file. If it does, simply verify that it does not reside within a <!-- --> comment tag.

Full documentation on the OC4J and PetStore setup may be found at Oracle's PetStore Demo webpage.

Step 5: Create a PetStore Rdb Database

The Java PetStore application will automatically create and populate its tables in a pre-existing Oracle Rdb database the first time it executes.

For instructions on creating a sample Oracle Rdb database that may be used by the Java PetStore, please refer to the Creating a Oracle Rdb Database for the Java PetStore Application webpage.

Step 6: Hook the Java PetStore Application to the PetStore Rdb Database

  1. Edit C:\Oracle\9iASCore\j2ee\home\config\data-sources.xml and add the following lines between the existing <data-source> and </data-source> tags. Notice the use of the computer name (MYAXP), oci_listener port (1527), database SID (PETRDB), username (estoreuser), and password (estore). Modify accordingly.
    <data-source 
        class="com.evermind.sql.ConnectionDataSource" 
    
        name="InventoryDB" 
        location="jdbc/InventoryDataSource" 
        xa-location="jdbc/xa/InventoryXADS" 
        ejb-location="jdbc/InventoryDB" 
        url="jdbc:oracle:thin:@MYAXP:1527:PETRDB" 
        connection-driver="oracle.jdbc.driver.OracleDriver" 
        username="estoreuser" 
        password="estore" 
        inactivity-timeout="30" 
    /> 
    
    <data-source 
        class="com.evermind.sql.ConnectionDataSource" 
        name="EstoreDB" 
        location="jdbc/EstoreDataSource" 
        xa-location="jdbc/xa/EstoreXADS" 
        ejb-location="jdbc/EstoreDB" 
        url="jdbc:oracle:thin:@MYAXP:1527:PETRDB" 
        connection-driver="oracle.jdbc.driver.OracleDriver" 
        username="estoreuser" 
        password="estore" 
        inactivity-timeout="30" 
    /> 
    
    
    <data-source 
        class="com.evermind.sql.ConnectionDataSource" 
        name="SignOnDB" 
        location="jdbc/SignOnDataSource" 
        xa-location="jdbc/xa/EstoreXADS" 
        ejb-location="jdbc/EstoreDB" 
        url="jdbc:oracle:thin:@MYAXP:1527:PETRDB" 
        connection-driver="oracle.jdbc.driver.OracleDriver" 
        username="estoreuser" 
        password="estore" 
        inactivity-timeout="30" 
    /> 
    

Step 7: Run the PetStore

  1. Run Petstore application in your browser using the url http://localhost:8888/estore or http://mypc:8888/estore.
 
E-mail this page
Printer View Printer View
Oracle Is The Information Company About Oracle | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Privacy