Oracle Application Server 10g: J2EE Deployment and Administration

OC4J Standalone has been certified to run under J2SE 1.3.1, 1.4.1, and/or 1.4.2 (depending on the platform). In most cases, applications developed using the standalone developer version will be deployed in production on a full Oracle Application Server 10g installation, so it's important to consider the requirements of each (see Chapter 1 for more information about the platforms supported by the full 10g Server). However, OC4J Standalone may be licensed for production use if the full version of Oracle Application Server 10g isn't needed.

Before installing OC4J Standalone to a development machine, check that the intended host meets the requirements listed in Table 3-1.

Table 3-1: OC4J Standalone Minimum Requirements

Operating system

Any, subject to JDK availability

Disk space

At least 64 MB (plus development space)

Memory

At least 64 MB (256+ MB recommended for most enterprise projects)

Connectivity

Access to the Internet or to a copy of the standalone installation package ( oc4j_extended.zip )

While OC4J is certified for Sun's Java Development Kit (JDK) (and JRockit, in the case of Linux on Intel), other JDKs such as IBM and Blackdown may work. Where possible, however, it's best to stick with a certified JDK for ease of support. Table 3-2 shows the certified minimum JDK releases.

Table 3-2: OC4J Standalone Minimum JDK Support

Platform

JDK Version

Red Hat Linux

1.4.2 or JRockit 8.1 SP1

UnitedLinux

1.4.2 or 1.3.1_06

Windows

1.4.1_05 or 1.3.1_06

Solaris

1.4.1_05

HP-UX

1.4.1_05 or 1.3.1_06

Downloading and Setting Up OC4J Standalone

OC4J Standalone is distributed as a ZIP file (typically around 30 MB, depending on the specific release) with no formal installation routine. Simply unzip it to the appropriate directory, run one command to set up the administrator password, copy in a compatible tools.jar , and it's ready to run. Do the following:

  1. Download OC4J Standalone from the Oracle Technology Network. As of this writing, you can download it directly from http://otn.oracle.com/software/products/ias/devuse.html or by visiting www.oracle.com and clicking Download. Under Application Server choose OracleAS Containers for J2EE (OC4J), then Production Software.

    Tip 

    The link to the OC4J Standalone version is grouped with links to JDBC drivers. Be sure to download the full oc4j_extended.zip (28 MB for 9.0.4, 33 MB for 9.0.4.1), not just the drivers.

  2. Expand the downloaded file ( oc4j_extended.zip ). There's no formal installation process so unzip it to the directory you intend to use as your OC4J home. Once expanded, there should be a Readme.txt file and around 12 subdirectories, including one called j2ee .

  3. Open a command prompt and navigate to OC4J_HOME/j2ee/home .

  4. Run java -jar oc4j.jar -install to set the administrator password, as follows :

    C:\java\oc4j\j2ee\home>java -jar oc4j.jar -install Auto-unpacking C:\home\oc4j\j2ee\home\applications\dms0.war... done. Auto-unpacking C:\home\oc4j\j2ee\home\applications\dms.war... done. To enable in-process JSP compilation (which can be faster in some cases), please add the path to your tools.jar in application.xml Example: <library path="../../../jdk/lib/tools.jar" /> Enter an admin password to use: password Confirm admin password: password If you are using J2SE 1.4 or higher, please ensure that all your imported classes are within packages, as required by the Java Language Specification. Installation done

    Congratulations! You have installed OC4J.

Tip 

In-process JSP compilation (mentioned in the install message) is discussed in Chapter 4.

Testing Your Installation

The OC4J installation includes a default web application with a welcome page and many JavaServer Pages (JSP) and Servlet examples. To verify that OC4J is installed properly, do the following:

  1. From the same directory ( OC4J_HOME/j2ee/home ), run java -jar oc4j.jar with no options.

  2. OC4J should start up and display something like this:

    C:\java\oc4j\j2ee\home>java -jar oc4j.jar Oracle Application Server Containers for J2EE 10g (9.0.4.0.0) initialized

  3. Open a browser and go to http://localhost:8888/ , which should appear as shown in Figure 3-1.

  4. From this page, browse to the JSP examples as shown in Figure 3-2.

  5. Try out the Numberguess example. If OC4J is configured properly, you should see something similar to Figure 3-3.

Figure 3-1: OC4J welcome page

Figure 3-2: OC4J JSP Samples page

Figure 3-3: OC4J Number Guess page

Tip 

If this page displays an internal server error and produces an error message that the "major.minor version number" is too recent for this tool to understand, then it's probably compiling the JSPs with an incompatible version of tools.jar . See Chapter 4 for more details about compiler configuration.

Exploring the Server Directory Structure

Once installed, the OC4J directory structure should look like Figure 3-4.

Figure 3-4: OC4J directory structure

The most important of these is the j2ee/home directory, which contains configuration files, application deployments, and other resources. Most of the other top-level directories support value-added features and aren't heavily used by the Standalone Edition.

The j2ee\home directory, often referred to as J2EE_HOME , contains a number of interesting subdirectories, including the following:

Категории