• Non ci sono risultati.

Downloading An OC4J-Ready Pet Store Demo

Nel documento Oracle9AS Containers for J2EE (pagine 52-55)

Download the Pet Store application from OTN at

http://otn.oracle.com/sample_code/tech/java/oc4j/content.html in the jps112.zip file, which downloads version 1.1.2 of the Pet Store demo. This ZIP file contains an annotated version of this application, along with preconfigured OC4J XML files.

You must have a working Oracle database and an OC4J installation. You should use this installation for demonstration purposes only and not in a production

environment. In this simplified version, we have pre-built the Pet Store demo using the Oracle database (instead of the default Cloudscape) and edited the

configuration files to make the setup easy.

1. Download the Pet Store application injps112.zip from OTN at

http://otn.oracle.com/sample_code/tech/java/oc4j/content.html. This ZIP file contains an annotated version of this application, along with

preconfigured OC4J XML files.

2. Unzip thejps112.zip file, which contains the following:

Note: Displays of the screens for each step of the deployment wizard are shown in"Deploying Applications" on page 2-20.

Configuring the Pet Store Web Application Demo

a. steps.html—Steps on how to deploy the Pet store demo in standalone mode. This HTML file does not contain directions on how to deploy using the Oracle Enterprise Manager. The steps in this manual instruct you on how to deploy using Enterprise Manager.

b. petstore.ear—The Pet Store demo is contained inpetstore.ear.

c. config.zip—OC4J server XML configuration files are provided for you inconfig.zip file.

3. Unzip theconfig.zip file to retrieve theserver.xml, default-web-site.xml, anddata-sources.xml files.

4. Edit thedata-sources.xml to point to your database by replacing the host, port, and sid in theurl attribute for the database in this file, as follows:

url="jdbc:oracle:thin:@<host>:<port>:<sid>"

5. Create in your database the userestoreuser, and grant this user privileges to connect asSYSDBA to your database. You can create the user and grant

privileges through the following command:

SQL> grant connect, resource to estoreuser identified by estore;

6. Navigate to the OC4J Home Page on the Oracle Enterprise Manager Web site.

7. Select default under the Default Application section. The default application is the automatic parent of each application and it holds global configuration for all deployed applications, such as the data sources used. You are going to add the data sources that Petstore uses in the default application.

8. Add data sources. On the default application screen, scroll down to the Administration section and select Advanced Properties from the Properties column.

Since the data sources are provided in adata-sources.xml file, add these data sources using the XML editor within Enterprise Manager. Select data-sources.xml in the filename column. This brings up a screen with XML in a text window. Merge in the data sources from the

data-sources.xml that was provided within theconfig.zip of the Petstore download into this window. Do not overwrite other data sources already configured in this file. When finished, click the Apply button.

Configuring the Pet Store Web Application Demo

9. Return to the OC4J Home Page and scroll to the Applications section. Click on the Deploy EAR File button. This starts the application deployment wizard.

10. Read the Introduction to the deployment wizard. Click the Next button.

11. Provide the EAR file and the name of your application in the Select Application page. Click the Browse button to find thepetstore.ear file that you

downloaded to your system. Type "petstore" in the application name field.

Click the Next button.

12. Provide the URL mappings for the servlet context on all Web modules in the Petstore application. The Petstore demo contains a single Web module, which should be mapped to the/estore servlet context. Type "/estore" in the URL mapping field and click the Next button.

13. At this point, the Petstore demo does not need any additional configuration through the wizard. You can jump to the Summary page by clicking Finish.

14. Read the summary of the Petstore application deployment. Click the Deploy button to complete the application deployment.

15. On the OC4J Home Page, select "petstore" in the Name column of the Applications section. This shows the configuration and all deployed modules of the Petstore demo application. If the OC4J server is started, the application is automatically started.

16. Execute the Pet Store application in your browser by accessing the OHS, where the default port is 7777.

http://<ohs_host>:<ohs_port>/estore

The Pet Store splash screen appears. Follow the instructions provided by the Pet Store application to load the Java Pet Store database tables.

Note: Because you were provided thedata-sources.xml file, you can add/modify this file directly through Advanced

Properties. If you do not have the XML file, you can add the configuration details through the Data Sources option under the Resources column.

Configuring the Pet Store Web Application Demo

Nel documento Oracle9AS Containers for J2EE (pagine 52-55)