0) { obj.className = "imgborder_on"; } } } function hideImage(obj) { if (obj.className.substr(0, 10) == "imgborder_") { obj.src = eyeglass.src; obj.className = "imgborder_off"; } } function showAllImages() { imgs = document.images; for (i=0; i < imgs.length; i++) { showImage(imgs[i]); } } function hideAllImages() { imgs = document.images; for (i=0; i < imgs.length; i++) { hideImage(imgs[i]); } } //-->

Deploying a Web Application

Purpose

In this tutorial, you use Oracle JDeveloper 10g to deploy a Web application to Oracle Application Server 10g or a standalone OC4J.

Time to Complete

30 minutes

Topics

The tutorial covers the following topics:

 Overview
 Prerequisites
 Starting the Environment
 Testing the Application
 Creating the Application Server Connection
 Creating Deployment Profiles
 Deploying the Application and Managing the Application Server
 Running the Application
 Summary

Viewing Screenshots

 Place the cursor over this icon to load and view all the screenshots for this tutorial. (Caution: This action loads all screenshots simultaneously, so response time may be slow depending on your Internet connection.)

Note: Alternatively, you can place the cursor over an individual icon in the following steps to load and view only the screenshot associated with that step. You can hide an individual screenshot by clicking it.

Overview

After you have built and tested an application and it works as planned, the next step is to deploy it to a location where users can run it. The general steps to deploy an application to any application server are basically the same, although there are some differences that come from the specific connection requirements of the server. JDeveloper has the built-in capability to deploy applications to a number of application servers.

In this tutorial, you deploy your application to a standalone instance of OracleAS Containers for J2EE (OC4J), which is identical to the process of deploying to Oracle Application Server 10g. You perform the following actions:

  • You install a pre-built application and test it in JDeveloper.
  • You use JDeveloper to create a deployable Java EE web archive that contains your application and a few required deployment descriptors.
  • You use the JDeveloper deployment mechanism to deploy the application to OC4J .
  • You view its performance by using Oracle Enterprise Manager Application Server Control.
  • You then test the application by running it in a browser from the OC4J instance.

Back to Topic List

Prerequisites

Before starting the tutorial, you should:

1.

Have access to or have installed Oracle JDeveloper (10.1.3.1.0). You can download it from Oracle Technology Network.

 

2.

Have access to or have installed Oracle Database 10g (Release 2 or Release 1). You can download it from Oracle Technology Network ( http://www.oracle.com/technology/software/products/database/oracle10g/index.html).

 

3.

Have access to or have installed the Oracle Sample Schemas. This OBE uses the OE schema that is included with Oracle Database 10g. In JDeveloper, you should create a database connection to the OE schema, and name it oeconn .

Instructions for installing the OE schema and creating a connection to it in JDeveloper are available online at:

http://www.oracle.com/technology/obe/obe1013jdev/common/OBEConnection.htm

Back to Topic List

Starting the Environment

 Start the Application Server
 Connect to the Application Server using Enterprise Manager
 Install the Required Application and Start JDeveloper

Back to Topic List

Start the Application Server

Oracle JDeveloper includes a standalone application server (standalone OC4J) . The following steps describe how to start standalone OC4J:

1.

Open the <jdev_home>\jdev\bin directory in Windows Explorer and double-click the start_oc4j.bat file to launch the standalone OC4J application server.

 

2.

If this is the first time you have run OC4J, it automatically installs and prompts you for a password for the administrator account. The administrator account is oc4jadmin. Enter the password welcome1 (no characters display as you enter the password.)

 

3.

The installation asks you to confirm the password by entering it a second time.

 

4.

When the install and startup are complete, you see the following message:
Oracle Containers for J2EE 10g <10.1.3.1.0> initialized

Leave the command window open, although you may minimize it if desired. OC4J is now running and ready for use.

Back to Topic

Back to Topic List

Connect to Standalone OC4J using Enterprise Manager

Oracle Application Server 10g comes with a browser-based Enterprise Manager (EM). Through this EM interface, you can use Application Server Control to monitor activities and applications deployed to the application server. After the application server is running, you can use a browser to connect to Application Server Control. The next few steps open this interface and briefly explore the application server. The standalone OC4J that comes with JDeveloper also includes Enterprise Manager.

To use a browser to connect to the EM of the standalone OC4J, perform the following steps:

1.

Open a browser of your choice (Firefox, Internet Explorer, or another browser) and enter the following URL: http://127.0.0.1:8888/em. If you are not using standalone OC4J, the URL is : http://127.0.0.1:7777/em.

 

2.

Enterprise Manager 10g prompts you for a username and password. The username is oc4jadmin with a password of welcome1 (or your administrator password). Click Login to enter Application Server Control.

 

3.

After successful login, the browser looks like the following:

 

4.

You can now explore applications, Web services, and other components of Oracle Application Server 10g. Click the Applications link to see which applications are loaded and running.

When you have finished exploring, close the browser window.

Back to Topic

Back to Topic List

Install the Required Application and Start JDeveloper

To install the application and start JDeveloper, perform the following steps:

1.

Download the predefined application. Save the OrderEntry.zip file locally on your system to a temporary location.

 

2.

Double-click the OrderEntry.zip file that you just downloaded and click Extract.

 

3.

Specify the folder where you want to extract the file, such as . <jdev_home>\jdev\mywork.

Once the files have been extracted, you can close the zip utility.

 

4.

Start JDeveloper. Double-click the JDeveloper executable ( jdeveloper.exe ) found in the <jdev_home> directory.

If the Migrate User Settings dialog box opens, click NO.

Close the Tip of the Day window.

 

5.

Click the Applications Navigator tab and from the Menu select File > Open

 

6.

Navigate to the location where you extracted the application files, such as <jdev_home>\jdev\mywork\OrderEntry . Select the OrderEntry.jws file and click Open.

Click Yes on the Warning dialog, then OK on the Migration progress dialog.

The application is now loaded into JDeveloper.

Back to Topic

Back to Topic List

Testing the Application

You can run and test an application within JDeveloper, using its embedded OC4J server, without the need to create application server connections or deploy the application. However, when you make the application available for users, you must deploy it to an external application server, which you simulate in this tutorial by deploying to the standalone OC4J.

Prior to testing the application, you should have created a JDeveloper connection to the OE database schema named oeconn, as described in the prerequisites. In this section of the tutorial you test the application in the embedded OC4J server by performing the following steps:

1.

Click the Applications Navigator tab, and expand the OrderEntry node.

 

2.

Right-click index.jsp in ViewController > Web Content and select Run from the context menu.

 

3.

The index page displays in your default browser. Click the Enter the Application link.

 

4.

In the search page, you can specify search criteria to query customers having a specific string in either first or last name and having a total order between low and high values that you can specify. Enter c% as the query criterion for the Customer Name. Then click Find to execute the query.

 

5.

In the detail part, click the CustLastName column heading twice to sort the records by the last name in descending order. Then select a row and click the Edit button.

 

6.

The edit page displays detail for the selected record.

Close the browser window.

Back to Topic List

Creating an Application Server Connection

The process of creating a connection to Oracle Application Server 10g is fundamentally the same as creating a connection to standalone OC4J. There are only a few differences in the arguments that you supply. To create a connection to standalone OC4J, perform the following steps:

1.

Click the Connections Navigator tab in the navigator window. If the Connections Navigator tab is not showing, choose View > Connection Navigator from the JDeveloper main menu.

 

2.

Right-click Application Server in the Connections window and select New Application Server Connection from the context menu.


3.

Click Next to skip the Welcome page of the Create Application Server Connection wizard .

 

4.

On the Type page of the wizard, name the connection OC4J and choose Standalone OC4J 10g 10.1.3 as the Connection Type. Click Next .

Note: If you're not connecting to the standalone OC4J server, select the appropriate connection type from the dropdown list.

 

5.

On the Authentication page of the wizard, enter oc4jadmin as the username and welcome1 (or whatever your administrative password is) as the password.

Select the Deploy Password checkbox, and then click Next to continue.

 

6.

On the Connection page of the wizard, enter localhost as the Host Name, and then click Next to continue.

 

7.

On the Test page of the wizard, click Test Connection. If the application server is available and the connection details are correct, you see the word Success! displayed in the Status area of the window.

If an error occurs, verify the connection settings, click Back to make any necessary changes, and then retest the connection.

If the connection is successful, click Finish to complete the connection.

You have just created a connection to the application server to host the deployment of your application.

Back to Topic List

Creating Deployment Profiles

Deployment profiles are project components that manage the deployment of an application. A deployment profile lists the source files, deployment descriptors (as needed), and other auxiliary files to include in a deployment package.

There are three parts of the deployment package for the order entry application: The Model project ( .jar file), the ViewController project ( .war file), and the entire application ( .ear file). You create deployment profiles for each of the three parts in this section of the tutorial.

 Creating a Deployment Profile for the Model Project
 Creating a Deployment Profile for the ViewController Project
 Creating a Deployment Profile for the Application

Back to Topic List

Creating a Deployment Profile for the Model Project

The first deployment profile you create is for the Model project. The contents of this project are primarily the Java classes that make up the data model portion of the application. The deployment type for this project is a JAR (Java Archive) file.

To create the model deployment profile, perform the following steps:

1.

In the Applications Navigator, right-click OrderEntry > Model and select New from the context menu.

 

2.

In the New Gallery, select General > Deployment Profiles in the Categories list, and then select JAR File in the Items list. Click OK.

 

3.

In the Create Deployment Profile dialog, change the Deployment Profile Name to ModelArchive . Click OK.

 

4.

In the JAR Deployment Profile Properties dialog, accept the default options by clicking OK.

 

5.

In the Applications Navigator, expand OrderEntry, Model, and Resources. Select the newly created deployment profile, ModelArchive.deploy. The Structure window displays the type and location of the archive to be deployed. (If the Structure window is not visible, select View > Structure.)

 

6.

Click Save All  on the JDeveloper menu bar, or select File > Save All from the menu. to save your work.

Back to Topic

Back to Topic List

Creating a Deployment Profile for the ViewController Project

The second deployment profile you create is for the ViewController project. This project contains the user interface components of the application. The deployment file for this project is a .war file (Web Archive, for the web components).

To create the user interface deployment profile, perform the following steps:

1.

In the Applications Navigator, right-click the ViewController project and select New from the context menu.

 

2.

In the New Gallery, select Deployment Profiles in the Categories list, and then select WAR File from the Items list. Click OK.

 

3.

In the Create Deployment Profile dialog, change the Deployment Profile Name to ViewArchive, and then click OK.

 

4.

In the WAR Deployment Profile Properties dialog, select the General node. In the Web Application’s Context Root, select the Specify J2EE Web Context Root option and enter OrderEntry. Click OK.

The context root becomes part of the URL that you use to access the deployed application.


5.

In the Applications Navigator, expand OrderEntry, ViewController , and Resources. Select the newly created deployment profile, ViewArchive.deploy. The Structure window displays the type and locations of the archives to be deployed. (If the Structure window is not visible, select View > Structure.)

 

6.

Click Save All  on the JDeveloper menu bar, or select File > Save All from the menu. to save your work.

Back to Topic

Back to Topic List

Creating Deployment Profile for the Application

To keep all the elements of your application organized and cleanly separated, you now create a project to hold all of the deployment components for your application. This project holds the deployment profiles and the deployment files ( .ear, .war, .jar). The approach of creating a deployment project, although not necessary, is convenient and offers a better separation of application code and deployment settings.

Now that you have created the .jar and .war files, you can assemble the application into a deployable package. In the assembly part of deployment, you create a deployment profile that includes any .jar and .war files you need for your application, along with other server configuration files that may be required, such as the data-sources.xml file to specify the data sources that may be used.

In some cases you may also want to add a jazn-data.xml file, such as for testing reasons or when the user population is small and it makes sense to deploy a pre-configured jazn-data.xml file for authentication and authorization. However, using OID or a third-party LDAP server that can be configured through Enterprise Manager is a better choice for production systems.

If there are any OC4J-specific deployment files needed in an application, they should be added to either the model project (in the EJB case) or the web application project. For the sake of having a portable .ear file, recommendation is to do all the OC4J-specific configurations in the EM console after deployment.

To create the deployment profile for the application, perform the following steps:

1.

In the Applications Navigator, right-click the OrderEntry node and select New Project from the context menu.

 

2.

In the New Gallery, select General > Projects in the Categories list, and then select Empty Project in the Items list. Click OK.

 

3.

In the Create Project dialog, enter Deployment as the Project Name and click OK.

 

4.

Right-click the new Deployment project in the Applications Navigator and select New from the context menu .

 

5.

In the New Gallery, select General > Deployment Profiles in the Categories list, and then select EAR File in the Items list. Click OK.

 

6.

In the Create Deployment Profile -- EAR File dialog, enter OrderEntryApplication as the Deployment Profile Name. Click OK

 

7.

In the EAR Deployment Profile Properties, select the Application Assembly node. Then select all the selectable check boxes, and then click OK.

 

8.

In the Applications Navigator, expand OrderEntry, Deployment , and Resources. Select the newly created deployment profile, OrderEntryApplication.deploy. The Structure window displays the type and location of the archive to be deployed. (If the Structure window is not visible, select View > Structure.)

 

9.

Click Save All  on the JDeveloper menu bar, or select File > Save All from the menu. to save your work.

Back to Topic

Back to Topic List

Deploying the Application and Managing the Application Server

 Deploy the Application to the Application Server
 Manage the Application Server

Back to Topic List

Deploying the Application to the Application Server

JDeveloper provides a one-click option to deploy an application to an application server. After you have assembled the application into an EAR file, you can right-click the deployment profile and select the target application server.

To deploy the application, perform the following steps:

1.

Right-click the OrderEntryApplication.deploy node in the Applications Navigator and select Deploy to > OC4J (which is the name of the connection that you created earlier.)

 

2.

In the Configure Application dialog, click OK to accept all defaults.

Note: During deployment, JDeveloper creates the .jar and .war files and then assembles the .ear file, as specified in the deployment profiles. After the file is assembled, JDeveloper deploys the file and unpacks it in a directory on the application server. The directory that is used is dependent on the target environment.

 

3.

Open the log window if not already opened ( View > Log )and check that deployment was successful.

 

4.

Open the command window where you started OC4J. You can see that the deployment was performed.

Back to Topic

Back to Topic List

Managing the Application Server

1.

Open a browser window and type the following URL to open the Enterprise Manager console:

http://127.0.0.1:8888/em

Note: If you are not using standalone OC4J, the URL is: http://127.0.0.1:7777/em

Log in using oc4jadmin/welcome1 and click Login.

 

2.

On the Home page, click the Applications link.

 

3.

You should be able to see the application that you just deployed, with a green upward arrow to show that it is running. Click the OrderEntryApplication link to provide access to the Application Administration page.

 

4.

Click the Administration link.


5.

You can review the services that were created during deployment. Click Go To Task for the JDBC Resources.


6.

Applications deployed to Oracle Application Server 10g or to standalone OC4J use a data source and connection pool to manage database access. You should be able to see the Data Sources and the Connection Pools entries that were created for the OrderEntryApplication.

Click the jdev-connection-pool-oeconn link in the Attributes Connection Pool column in the Data Sources section of the page.

 

7.

You can review the connection parameters. Notice that the password for the oe user is not visible.

 

8.

Click the Back button twice. In the Administration page, click Go To Task for Security Provider .

 

9.

This is the page where you set security rules for your deployed applications.

Close the Browser window.

Back to Topic

Back to Topic List

Running the Application

Now that you've deployed the application, you can run it from the application server.

The next few steps take you through the testing process.

1.

Open a Browser window and enter the following URL, which contains the context-root OrderEntry that you specified earlier:

http://127.0.0.1:8888/OrderEntry/faces/index.jsp

Click the Enter the Application link.


2.

Reenter search criteria and click Find to execute the query.

 

3.

Select a row from the order list and click Edit

 

4.

The edit page displays the Order detail.

Close your browser window. You've successfully deployed and tested a predefined application in Oracle Application Server 10g.

Back to Topic List

Summary

In this tutorial, you installed a predefined application and tested it in JDeveloper's embedded OC4J server. You then started the standalone OC4J server and created a JDeveloper connection to it. You created deployment profiles for the application, and then you deployed the application to standalone OC4J, which simulates deployment to Oracle Application Server 10g. You used Application Server Control to review the administration details of the application. Finally, you tested the application by running it from the application server in a browser.

In this tutorial, you learned how to:

Start the environment

Test the application in the embedded OC4J server

 Create a connection to the application server

Create deployment profiles

Deploy the application and manage the application server

Run the application

Back to Topic List

 Place the cursor over this icon to hide all screenshots.

 

 

 

Left Curve
Popular Downloads
Right Curve
Untitled Document