Switch to standard view
Sybase logo  
Sybase logo  
Products | About Sybase | Support



Deploying the Java PetStore 1.3 Sample Application on Sybase EAServer 4.1.0

Instructions follow. If you would like these instructions in more complete, downloadable format, click here for the white paper in .pdf format..

Click here to access the Java Pet Store application in CodeXchange.

This paper provides a step by step process to deploy and configure the Java Petstore 1.3 on EAServer 4.1.0. The Petstore 1.3 application conforms to the J2EE 1.3
spec. This version of the Petstore application makes use of the new features like JMS and servlet filters, and EJB container managed persistance (cmp 2.0). The
successful deployment of the Java PetStore 1.3 application clearly indicates EAServer's ability to implement the new features included in the J2EE 1.3 spec and
the ability to conform to the spec.

Step-1: Download EAServer 4.1.0 and install it
Step-2: Start EAServer
Step-3: Setup the database
Step-4: Download the Java Petstore application
Step-5: Deploy the Java Petstore to EAServer using Ant
Step-6: Copy the populate.sql file (Skip this step if the database is ASA)
Step-7: Install the applications on the server
Step-8: Test the PetStore application

Step-1: Download EAServer 4.1.0 and install it

To run the this application you will need EAServer 4.1.0 or greater. Download the eval version from the following link

http://www.sybase.com/easerver4dev

Use the installation manuals provided to complete the installation

Step-2: Start EAServer

To start EAServer;

Run serverstart.bat in the %JAGUAR%\bin directory

When startup is complete, you should see the message

accepting connections

Step-3: Setup the database

This step can be skipped if the database used is Sybase Adaptive Server Anywhere (ASA). If the database being used is Adaptive Server Enterprise (ASE), then do the following:

Login as sa and enter following isql commands to create petstore database

and login on your ASE data server. Please make sure that you have a device

called "user_disk" of size 20MB .

create database estore_1_3 on user_disk=10

go

alter database estore_1_3 log on user_disk

go

sp_addlogin estore13, estore13, estore_1_3

go

use estore_1_3

go

sp_adduser estore13

go

Ensure that the database server is running.

Step-4: Download the Java Petstore application

Download and extract the files from the JPS_1_3 zip file (in CodeXchange) into a temporary location. The zip file contains 4 ear files, build.xml file required by ant, populateSQL.xml (used if database is ASE) and truncjms.sql (used if database is ASE) file that is used to truncate the old JMS messages in the database if database is ASE.

Step-5: Deploy the Java Petstore to EAServer using Ant

The Petstore application can be deployed on EAServer quickly by using Ant.. Ant can be downloaded from the following link. Once Ant is installed add jagtool.jar (found in the %JAGUAR%\java\lib directory of the installation) to your classpath.

http://jakarta.apache.org/ant/index.html.

The Java Pet Store application also requires Java Web Start which can be downloaded from the following location:

http://java.sun.com/products/javawebstart/

Edit the build.xml file to modify variable names to suit your machine. The following lines in the build.xml file need to be modified. These values (in bold) need to be changed according the EAServer and database host configuration on your machines. The build.xml is by default configured to use ASA as the database. If ASE is being used the appropriate changes need to be made to the connection cache properties in the build.xml script.

If the database in use is ASA then make the following changes in the build.xml file.

<!-- =================================================================== -->

<!-- Prepares the variables - Database is ASA

<!-- =================================================================== -->

<property name="jaguar.host" value="hostname"/>

<property name="jaguar.port" value="9000"/>

<property name="jaguar.user" value="jagadmin"/>

<property name="jaguar.password" value=""/>

<property name="source.dir" value="C:\petstore\SunEARs"/>

<property name="ear.sourceOpc" value="${source.dir}\opc"/>

<property name="ear.sourcePetstore" value="${source.dir}\petstore"/>

<property name="ear.sourceAdmin" value="${source.dir}\petstoreadmin"/>

<property name="ear.sourceSupplier" value="${source.dir}\supplier"/>

<property name="smtp.server" value="rhino"/>

<!-- properties for the Connection Cache setup -->

<property name="cache" value="estore_1_3"/>

<property name="existingCache" value="JavaCache"/>

<property name="jdbc.DBUrl" value="jdbc:sybase:Tds:hostname:2639"/>

<property name="jdbc.Driver" value="com.sybase.jdbc2.jdbc.SybDriver"/>

<property name="jdbc.DBtype" value="Sybase_ASA"/>

<property name="jdbc.user" value="dba"/>

<property name="jdbc.password" value="sql"/>

If the database used is ASE then then make changes in the build.xml file

<!-- =================================================================== -->

<!-- Prepares the variables - Database is ASE

<!-- =================================================================== -->

<property name="jaguar.host" value="hostname"/>

<property name="jaguar.port" value="9000"/>

<property name="jaguar.user" value="jagadmin"/>

<property name="jaguar.password" value=""/>

<property name="source.dir" value="C:\petstore\SunEARs"/>

<property name="ear.sourceOpc" value="${source.dir}\opc"/>

<property name="ear.sourcePetstore" value="${source.dir}\petstore"/>

<property name="ear.sourceAdmin" value="${source.dir}\petstoreadmin"/>

<property name="ear.sourceSupplier" value="${source.dir}\supplier"/>

<property name="smtp.server" value="rhino"/>

<!-- properties for the Connection Cache setup -->

<property name="cache" value="estore_1_3"/>

<property name="existingCache" value="JavaCache"/>

<property name="jdbc.DBUrl" value="NetworkProtocol=Tds:Server=hostname:Port=?portNumber?/>

<property name="jdbc.Driver" value="com.sybase.jdbc2.jdbc.SybConnectionPoolDataSource"/>

<property name="jdbc.DBtype" value="Sybase_ASE"/>

<property name="jdbc.user" value="estore13"/>

<property name="jdbc.password" value="estore13"/>

Save the changes and execute ANT script. The entire deployment takes less than 6 minutes.

Step-6: Copy the populate.sql file (Skip this step if the database is ASA)

Copy the populate.sql file from the install source to the %JAGUAR%\repository\WebApplication\PetStoreWAR\populate directory to overwrite the existing file

Step-7: Install the applications on the server

Log in to Jaguar Manager and do the following:

  • Highlight the server where you want to install petstore.
  • Right click on "Installed Applications" folder.
  • Choose "Install an Existing Application". Install all 4 ears one by one
  • Restart your Jaguar server now.

Step-8: Testing Pet store

Connect to

http://host:port/petstore -- for creating orders.

http://host:port/petstore -- click on administrator client (requires java web start).

http://host:port/rcvr -- for supplier web interface.

Remember, the first time takes long as CMP tables are created, JSPs are complied, etc. So please be patient. Moreover, you should specify your email address while placing the order. That way if everything worked as expected, you should get two emails. This confirms the whole test. You should go to admin web console and verify that the order is in COMPLETED state. Login to supplier and check if the inventory of the item you just ordered, is reduced.



[#]Home  [*]Top

© Copyright 2008, Sybase Inc.