Skip Headers
Oracle® Containers for J2EE Deployment Guide
10g (10.1.3.1.0)

Part Number B28951-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

13 Deploying Web Applications from Eclipse

This chapter explains how to deploy a Web application to a standalone OC4J server directly from Eclipse 3.2 using the Web Tools Platform, which includes support for OC4J, and how to use OC4J Ant tasks for deployment through Eclipse, in these sections:

Deploying a Web Application with the Web Tools Platform

This section provides an overview of how to create and deploy a Web application to OC4J using the Eclipse Web Tools Platform.

Connecting to OC4J from Eclipse

This section shows you how to connect to a standalone OC4J instance from Eclipse.

  1. Launch Eclipse.

  2. Open the J2EE perspective and select Window > Open Perspective > Other menu. Choose J2EE in the resulting dialog. This perspective includes the Servers view, which is used in the example deployment.

  3. Select Window > Show View > Console menu. This enables you to see the server output.

  4. Right-click in the Servers View and select New > Server menu. This launches the New Server wizard.

  5. In the Define a New Server panel, select Oracle > Generic Oracle OC4J Standalone Server 10.1.3. Click Next.

  6. Set the following in the Define a New Generic Oracle OC4J Standalone 10.1.3 Runtime panel:

    • For JRE, select the JDK you are using.

    • For Oracle J2EE Home, browse to the \j2ee\instance subdirectory in the folder where you installed the Oracle Application Server.

    • Click Next.

  7. Set the password to the password for the oc4jadmin administrator account you created during the OC4J installation in the Create a new Generic Oracle OC4J Standalone 10.1.3 server panel. Accept the defaults for all the other fields.

  8. Click Finish.

Building a Web Application

Next, create a simple Web application to deploy to the OC4J server instance.

  1. From the ProjectExplorer view, right-click on the Dynamic Web Projects folder and select New Dynamic Web Project.

  2. Enter a name for the project.

  3. Click the Show Advanced button. Note that the Target runtime field is pre-populated with the entry for OC4J: Generic Oracle OC4J Standalone 10.1.3.

  4. Accept the default values for all the fields in this dialog and click Finish.

  5. Now you will create a JSP page within your new project. Open the Dynamic Web Projects folder.

  6. Expand the project you created and then the WebContent folder.

  7. Right-click on the WebContent folder and select the New JSP menu.

  8. Enter a name for the file, such as index.jsp, and click Finish.

  9. The file is opened in a JSP Editor. Enter this text between the <BODY> tags:

    <% out.print("Hello World!!"); %>

  10. Save the file.

Deploying a Web Application

Once the Web application is ready, it can be deployed to OC4J directly from Eclipse.

  1. Right-click on the JSP file, index.jsp, in the ProjectExplorer. Select Run As > Run on Server menu.

  2. In the Run On Server dialog box, verify that the server Oracle OC4J Standalone Server v10.1.3 is selected.

  3. Click Finish. The Eclipse WTP tool will now do the following:

    • Package the Web application.

    • Start the OC4J server if it is not running.

    • Publish the application to the OC4J instance.

    • Launch the application in a browser.

      The console view displays the log tracking the progress of the deployment.

Using Ant Tasks from the OC4J Administration Client with Eclipse

You can use Ant tasks for deploying Web applications from Eclipse if you include ant-oracle.jar in the class path with the appropriate client libraries. Follow these steps to set up your environment for using Ant tasks with Eclipse:

  1. If you do not have a local OC4J environment (either a standalone OC4J server or Oracle Application Server), then download or copy oc4j_admin_client.zip and extract the OC4J administration client, as "Downloading and Extracting the Remote Administration Client" describes.

  2. Copy the ant-oracle.xml and ant-oracle.properties file from the ORACLE_HOME\j2ee\utilities directory into the project.

  3. Set the ORACLE_HOME environment variable to the location of the OC4J installation: OC4J, Oracle Application Server, or oc4j_admin_client.

    This can be done at startup, as a System variable, or from the Ant Runner mechanism in Eclipse.

For more information about OC4J Ant tasks, see Chapter 10, "Using OC4J Ant Tasks for Deployment".