Oracle® Containers for J2EE Deployment Guide 10g (10.1.3.1.0) Part Number B28951-01 |
|
|
View PDF |
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:
This section provides an overview of how to create and deploy a Web application to OC4J using the Eclipse Web Tools Platform.
This section shows you how to connect to a standalone OC4J instance from Eclipse.
Launch Eclipse.
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.
Select Window > Show View > Console menu. This enables you to see the server output.
Right-click in the Servers View and select New > Server menu. This launches the New Server wizard.
In the Define a New Server panel, select Oracle > Generic Oracle OC4J Standalone Server 10.1.3. Click Next.
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.
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.
Click Finish.
Next, create a simple Web application to deploy to the OC4J server instance.
From the ProjectExplorer view, right-click on the Dynamic Web Projects folder and select New Dynamic Web Project.
Enter a name for the project.
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.
Accept the default values for all the fields in this dialog and click Finish.
Now you will create a JSP page within your new project. Open the Dynamic Web Projects folder.
Expand the project you created and then the WebContent folder.
Right-click on the WebContent folder and select the New JSP menu.
Enter a name for the file, such as index.jsp
, and click Finish.
The file is opened in a JSP Editor. Enter this text between the <BODY> tags:
<% out.print("Hello World!!"); %>
Save the file.
Once the Web application is ready, it can be deployed to OC4J directly from Eclipse.
Right-click on the JSP file, index.jsp
, in the ProjectExplorer. Select Run As > Run on Server menu.
In the Run On Server dialog box, verify that the server Oracle OC4J Standalone Server v10.1.3 is selected.
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.
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:
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.
Copy the ant-oracle.xml
and ant-oracle.properties
file from the ORACLE_HOME
\j2ee\utilities
directory into the project.
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".