24 August 2005

Wiring OHS and OC4J together

With the recent Oracle Application Server 10g (10.1.3) Developer Preview 4 (what a mouthful!) release we put on OTN, it's possible to perform installations which lay down just Oracle HTTP Server or just Oracle Containers for J2EE (OC4J). This provides a finer grained install model than in previous releases, allowing boxes to be dedicated to servicing HTTP requests, and other boxes to be dedicated to hosting J2EE applications and services.

Once you have these two separate installations done, the question is -- how do you wire them together so that the OHS instance can route requests for J2EE applications to the OC4J instance which is hosting them?

Configuration Steps:

Well it's pretty simple really, here's the quick and dirty commands to do it.

OHS Server (or installation if on same box)

Within the OHS server installation directory, execute the following command:

>cd $ORACLE_HOME/opmn/bin
>opmnctl config topology update discover="*225.0.0.2:6789"

OC4J Server** (or installation directory if on same box)

Within the OC4J server installation directory, execute the following commands:

>cd $ORACLE_HOME/opmn/bin
>opmnctl config topology update discover="*225.0.0.2:6789"
>opmnctl config port update ias-component=OC4J process-type=home portid=default-web-site protocol="AJP"


** do this for each OC4J installation you want to include within this shared group of instances. The single OHS instance can front end multiple OC4J installations.

Brief Explanation:

So what do these commands do?

>opmnctl config topology update discover="*225.0.0.2:6789"

What this command will do is to configure the OPMN infrastructure with a common discovery address, enabling the separate installations to discover and communicate with one another. You will note that we execute the exact same command within both installations, with the exact same address. If the address is different, then the two installations will not be able to discover each other.

>opmnctl config port update ias-component=OC4J process-type=home portid=default-web-site protocol="AJP"

On the OC4J installation, this additional command is performed. What this does it to switch the protocol the OC4J instance is using to listen from requests to the AJP protocol, which is used by mod_oc4j to dispatch requests to an OC4J instance. The out of the box OC4J installation will be configured to use the HTTP protocol, enabling it to be accessed and used directly from a browser.

Whenever you want OHS to sit in front of the OC4J instance, you just need to switch the protocol.

Any of the apps which you've deployed and bound to a context-root within your OC4J instance will then be accessible via the OHS URL.

2 comments:

Anonymous said...

Hi!!!

How i can setup the multicast address in the servers involved in the cluster?

This multicast address is physical interface network in the servers?

Najeeb said...

Hi, how can i configure to get the oascontrol login page by OHS Url without mentioning the context root in the browser.
Means i have configured a VirtualHost in httpd.conf for www.test.com, now when i type www.test.com in the browser i should be able to get www.test.com/em.
As you know /em is the context root of ascontrol web application.
Above is just an example.
my Aim is to redirect an OHS url to a url of Web Application in the OC4J Instance. Do you have any solutions to achieve this?
I tried ReWrite Directive in the Virtual Host, but it is looking for a physical path "\em" which doesnt exist and so it fails..