Oracle Application Server Containers for J2EE 10g (10.0.3)

Last Updated: 03/09/2004

How-To: Deploy Java Adventure Builder Reference Application v1.0

After completing this How-to you should be able to:

If you are interested in seeing the packaging changes made by Oracle or want to rebuild the application from scratch with Oracle specific deployment descriptors please look at how-to-rebuild-adventure-builder.html.

Software Requirements

The following software components are required to complete this how-to:

Notations Used

Introduction

According to Sun Microsystems, the Java Adventure Builder Reference Application v1.0 (Adventure Builder) is a blue print application that demonstrates the latest J2EE 1.4 technologies. You can find more info about the application at http://java.sun.com/blueprints/code/adventure/1.0/docs/index.html. 

This document describes how to deploy Adventure Builder Early Access 1.0 on OC4J.  You can choose to either download the original application directly from the Sun website and make the necessary changes to deploy it on OC4J, or you can download the pre-configured application to run on OC4J from OTN. It should be noted that Oracle have no application code changes to run this on OC4J; the only changes required are the provision of the OC4J specific deployment descriptors, and several code fixes to workaround non portable coding issues in the Adventure Builder code.

The Adventure Builder application consists of six modules:

The Order Processing Center module (OPC.ear), ActivitySupplier, AirlineSupplier, Bank, LodgingSupplier have EJBs (entity beans, MDBs and stateless EJB web services exposed via JAX-RPC end-point) to process and track orders.

The Adventure Builder web module (ConsumerWebsite.ear) provides a web interface to search and submit orders for adventure packages. This web module uses Stateless EJB 2.1 webservices to submit and track adventure orders.

Contents of this How-To

The example contains following files:

Configuring OC4J 10g (10.0.3) and the Database

The process of deploying this portable, J2EE application requires the following primary steps:

To deploy the Adventure Builder, you have to make the following configuration changes to your OC4J instance to provide the physical resources required by the application.

You can choose to either deploy the supplied application in this distribution which has the mappings already in place, or rebuild the application supplied from the Sun website with the Oracle specific changes as outlined below.

Database and DataSource configuration

The original Adventure Builder application comes with a script to be used with a supplied PointBase database. We have modified the script for use with Oracle databases.  However we have also provided the steps to configure OC4J with PointBase database for using with the application. Please click here if you want to use a PointBase database instead.

Using an Oracle Dabatase

1) Configure the Oracle database prior to configuring OC4J or deploying the application using the supplied SQL script scripts/oracle.sql. This script creates the table and necessary data for using the application. If you are using SQL*Plus with Oracle database you can use the following command, assuming you you already have a user created named ab.

>sqlplus ab/ab @oracle.sql

 2) Create a Data Source on OC4J to connect to the user in which the necessary tables and data are loaded. The data source must have an ejb-location defined as jdbc/adventure/AdventureDB  that points to your database.  For example, your %OC4J_HOME%/j2ee/home/config/data-sources.xml would have an entry like following:

<data-source
  class="com.evermind.sql.DriverManagerDataSource"
  name="OracleDS2"
  location="jdbc/OracleCoreDS2"
  xa-location="jdbc/xa/OracleXADS2"
  ejb-location="jdbc/adventure/AdventureDB"
  connection-driver="oracle.jdbc.driver.OracleDriver"
  username="ab"
  password="ab"
  url="jdbc:oracle:thin:@oc4j.us.oracle.com:1521:db"
  inactivity-timeout="30"
/>

Using PointBase Dabatase

It is assumed that you have PointBase database installed and you have configured the database for use with AdventureBuilder application as documented by Sun.

1) Copy the PointBase JDBC driver supplied with Adventure Builder, pbclient.jar to  %OC4J _HOME%/j2ee/home/applib directory

2) Create a DataSources to use the PointBase database as follows. You will need to make adjustments for your specific environment. 

<data-source
  class="com.evermind.sql.DriverManagerDataSource"
  name="OracleDS2"
  location="jdbc/OracleCoreDS2"
  xa-location="jdbc/xa/OracleXADS2"
  ejb-location="jdbc/adventure/AdventureDB"
  connection-driver="com.pointbase.jdbc.jdbcUniversalDriver"
  min-connections="1"
  max-connections="5"
  username="adventurebuilder"
  password="
adventurebuilder"
  url="jdbc:pointbase:server://localhost:9092/
sun-appserv-samples"
  inactivity-timeout="30"
/>

Configure OC4J Resources

Adventure Builder relies on a number of resources to be provided by a J2EE container. These resources must be configured for OC4J.

Mail Server

To enable the application to generate emails on the submission and completion of orders, you have to configure a mail-session resource on OC4J.

1) Edit the %OC4J_HOME%/j2ee/home/config/application.xml  file and add an entry for the mail server you wish to use. For example, your application.xml would have the following entry:

<mail-session location="mail/MailSession" smtp-host="mailhost.maildomain.com">
  <property name="mail.transport.protocol" value="smtp"/>
  <property name="mail.smtp.from" value="yourmail@yourhome.com"/>
</mail-session>

JMS Queues

Adventure Builder uses message queues to transmit order and fulfillment details. Several JMS queues must be configured for Adventure Builder to use.

1) Queues and QueueConnectionFfactories are configured in the %OC4J_HOME%/j2ee/home/config/jms.xml. You can use the supplied jms.xml file in the %HOW_TO_HOME%/config directory as a template.  Otherwise you have to add the following entries to your jms.xml file.

<queue name="jms/airline/AirlineQueue" location="jms/airline/AirlineQueue">
<description>Oracle Syndication Services Queue</description>
</queue>

<queue-connection-factory name="jms/airline/QueueConnectionFactory"
  location="jms/airline/QueueConnectionFactory"/>

<queue name="jms/activity/ActivityQueue" location="jms/activity/ActivityQueue">
  <description>Oracle Syndication Services Queue</description>
</queue>

<queue-connection-factory name="jms/activity/QueueConnectionFactory"
  location="jms/activity/QueueConnectionFactory"/>

<queue name="jms/lodging/LodgingQueue" location="jms/lodging/LodgingQueue">
  <description>Oracle Syndication Services Queue</description>
</queue>

<queue-connection-factory name="jms/lodging/QueueConnectionFactory"
  location="jms/lodging/QueueConnectionFactory"/>

<queue name="jms/opc/WorkFlowMgrQueue" location="jms/opc/WorkFlowMgrQueue">
  <description>Oracle Syndication Services Queue</description>
</queue>

<queue-connection-factory name="jms/opc/QueueConnectionFactory"
  location="jms/opc/QueueConnectionFactory"/>

<queue name="jms/opc/OrderFillerQueue" location="jms/opc/OrderFillerQueue">
  <description>Oracle Syndication Services Queue</description>
</queue>

<queue name="jms/opc/CRMQueue" location="jms/opc/CRMQueue">
  <description>Oracle Syndication Services Queue</description>
</queue>

<queue name="jms/opc/WebServiceBrokerQueue" location="jms/opc/WebServiceBrokerQueue">
  <description>Oracle Syndication Services Queue</description>
</queue>

Deploying the Application

The simplest way to get the application deployed and running is to utilize the pre-built enterprise archive files supplied in the %HOW_TO_HOME% /apps directory.

An Ant build script is provided which contains a deployment target. This deployment target, 'deploy', will deploy the pre-built EAR files to a specified OC4J instance. The Ant script utilizes the OC4J command line utility admin.jar

Using Ant and admin.jar

  1. Make sure that OC4J 10.0.3 is started with the required configuration changes.

  2. Make sure that you have OC4J_HOME and HOW_TO_HOME environment variables are set.

  3. This example assumes the default password for your application to be welcome. If you have a different password please make necessary modifications in the build.xml.

  4. Deploy the applications using the following command:

    ant deploy

Ant Deploy Start

Start of Ant Deployment

Finish of Ant Deployment

Finish of Ant Deployment

Running the Application

Once the application has been successfully deployed using the Ant build script, you can test the application by accessing the web application using the URL
http://localhost:8888/ab/

Adventure Builder Launch Screen

Adventure Builder Launch Screen

Adventure Builder Main Application Screen

Adventure Builder Main Application Screen

Summary

In this document you should have:

Rebuilding the Adventure Builder Application

If you are interested in seeing the packaging changes made by Oracle or want to rebuild the application from scratch with Oracle specific deployment descriptors please look at how-to-rebuild-adventure-builder.html.