Saturday, December 02, 2006

OC4J HTTP Server on OracleAS 10.1.3.1

Here's a deep in the muck kind of post for those who want to know the gory internals of Oracle Application Server and two ways of having an HTTP server set up on it.

Oracle provides an HTTP server out of the box if you download OC4J stand-alone - the 80M download here - http://www.oracle.com/technology/software/products/ias/index.html. If you choose the second download (470M) along with what we call the SOA Suite (BPEL PM, Web Services Manager, Oracle Rules and our new ESB), you will get the managed environment owned by Oracle Process Manager and Notification Service (OPMN) and Oracle HTTP Server - a slight derivate of Apache HTTP Server packaged with Oracle DB RSFs amongst other things.

Sometimes people like to use the OC4J HTTP server which is extremely lightweight, written in Java and does great for high performance smaller environments or even popular in larger environments if you throw a hardware load balancer in front of several OC4J containers - emulating what OHS does out of the box. We have an install option for this lighter weight approach, shown here, where you get our J2EE server with the OC4J HTTP server rather than OHS (the OHS one been the first and second choices, OC4J HTTP being the highlighted choice):


But of course what almost invariably happens is that you choose the first and second choice and then realize you don't want the OHS listener - maybe too much to manage or in production you expect to use generic Apache, SunOne or IIS ... whatever it is - and decide to revert back to the OC4J HTTP server. While it isn't exactly hard, it isn't exactly perfectly intuitive either. So here's how to do it:

1. Shut down your application server:

$ORACLE_HOME\opmn\bin\opmnctl stopall

2. Go to your $ORACLE_HOME\opmn\conf\opmn.xml and find the line:

<ias-component id="HTTP_Server">

and replace it with:

<ias-component id="HTTP_Server" status="disabled" >

What you have done here is turned off the Oracle HTTP Server


3. Now lets turn on the OC4J HTTP Listener. Go to $ORACLE_HOME\opmn\conf\opmn.xml and find the line:

<port id="default-web-site" range="12501-12600" protocol="ajp"/>

and change it to

<port id="default-web-site" range="80" protocol="http"/>

I am assuming you want it on port 80 here; choose the appropriate HTTP port for your machine. You can also do this in Application Server Control screen shown below but you have to make sure OracleAS is running and then after making the change, bounce the OC4J instance you are doing this on. Frankly speaking, it is probably easier just to edit the file when the server is stopped for this kind of surgery.



4. Lastly, edit the file $ORACLE_HOME/j2ee/config/default-web-site.xml and you will see a line like this:

<web-site xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/web-site-10_0.xsd" protocol="ajp13" port="0" display-name="OC4J 10g (10.1.3) Default Web Site" schema-major-version="10" schema-minor-version="0" >

Noted the bolded lines here - we need to make the default web site wire up to the ports and protocol in opmn.xml as follows:


<web-site xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/web-site-10_0.xsd" protocol="http" port="80" display-name="OC4J 10g (10.1.3) Default Web Site" schema-major-version="10" schema-minor-version="0" >

5. Re-start the server:

$ORACLE_HOME/opmn/bin/opmnctl startall

Now your server should be happily using the Java based OC4J HTTP listener and not using the Apache based Oracle HTTP Server.


No comments: