HomeOracle Page 7 - Creating, Copying, and Managing OC4J Instances
CERTIFICATION OBJECTIVE 8.05 - Oracle
In this second part of a multi-part series covering the management of OC4J and configuring J2EE applications with Oracle 10g Application Server, we focus in on OC4J instances. This article is excerpted from chapter eight of the Oracle 10g Application Server Exam Guide, written by Sam Alapati (McGraw-Hill; ISBN: 0072262710).
When I mention configuring OC4J, I mean something broader than merely configuring the OC4J server itself. Our main motivation in learning about the OC4J server is to learn how to deploy J22 applications with it. Thus, configuring OC4J involves the configuration of the OC4J server itself, as well as the configuration of the J2EE applications framework. In addition, you must configure the mod_oc4j module, which lets the Oracle HTTP Server communicate with the OC4J server instance.
An OC4J instance has three groups of configuration files: mod_oc4j configuration files, OC4J server configuration XML files, and the J2EE application deployment XML files. As you can tell, you use the first set of files to configure the interaction of the mod_oc4j module with the Oracle HTTP Server. You use the second set of files to configure the OC4J server proper, and the last set of configuration files to configure the deployment of J2EE applications via the OC4J server. These three groups of configuration files are reviewed in the following subsections.
on the job: Port number 7777 is the default port for the Oracle Web listener. You must specify the port number if you are using a non-default port number. However, OracleAS Web Cache uses port 7777, and the HTTP server will actually be listening on port 7778.
on the job:You canít modify J2EE XML files such as web.xml and ejb-jar.xml after deploying an application. You can, however, modifythe OC4J-specific XML files of the application.
The mod_oc4j Configuration Files
The mod_oc4j HTTP server module facilitates communication between the Oracle HTTP Server and the OC4J instance and enables access to HTTP clients. The mod_oc4j module runs within the HTTP server and performs the following functions:
Identifying the requests it needs to serve
Determining the particular OC4J instance it should route the request to
Communicating with the selected OC4J instance backend processes
OPMN keeps mod_oc4j aware of the status of the instances, and thus, oc4j will route jobs only to the running processes. Because mod_oc4j is aware of the OracleAS
exam watch: The mod_oc4j module is embedded in the Oracle HTTP Server module and is in charge of forwarding OC4J requests from clients. The mod_oc4j.conf file configures the mount points or virtual paths specifying the contexts that it should forward to the OC4J instance.
Clusters and OC4J islands (an OC4J island is a set of OC4J processes that replicates session state among all the OC4J processes that are part of the island) the OC4J processes can run on multiple nodes, and its routing is calculated to provide transparent failover as well.
By default, the mod_oc4j module will direct all j2ee/ context-bound applications to the OC4J server. You can, however, add other mount points for this context in the mod_oc4j. conf file, if you plan on using other contexts (for example, test/). Once you start your Oracle HTTP Server, the context changes will be in effect and all new requests for the test/ context will be sent to the OC4J server.
The mod_oc4j configuration files are located in the following directory:
Hereís a typical mod_oc4j configuration file, named oc4j.conf:
########################################## # Oracle iAS mod_oc4j configuration file: mod_oc4j.conf ########################################## LoadModule oc4j_module modules/ApacheModuleOc4j.dll <IfModule mod_oc4j.c> <Location /oc4j-service> SetHandler oc4j-service-handler Order deny,allow Deny from all Allow from localhost ntl-alapatisam.netbsa.org ntl-alapatisam </Location> Oc4jMount /j2ee/* Oc4jMount /forms90 FORMS_PROD </IfModule>
Letís brieﬂy analyze the oc4j.conf file, which is called as part of the Oracle HTTP Server configuration file httpd.conf.
The LoadModule directive tells the Oracle HTTP Server that the oc4j_module should be loaded each time the Oracle HTTP Server starts.
The <IfModule> directive tells the HTTP server what it should do when it encounters the oc4j_module in the httpd.conf file, which is the configuration file for the Oracle HTTP Server.
The <Location> directive specifies the virtual path /oc4j-service, which will launch the oc4j-service handler, but only if the URL comes from the address specified within the Location directive.
The lines starting with the Oc4jMount command help set the URL mapping. The Oc4jMount command lines specify the virtual paths for mod_oc4j to route to a particular OC4J instance. For example the virtual path /j2ee/* belongs to the OC4J home instance. Any request that contains the regular expression /j2ee/* is then routed to the home OC4HJ instance. In this example, the URL mapping for this OC4J instance makes the Oracle Application Server route all requests for /forms90 FORMS_PROD to this OC4J instance. You can look at this as the rough mod_oc4j equivalent of an OHS Alias. All deployed J2EE applications must be associated with a "root context" (an URL prefix), which serves to identify the requests that need to be handled by mod_oc4j. The Oc4jMount command maps the root context to the particular OC4J instance to which an application is deployed.
Please check back next week for the continuation of this article.