Tuesday, April 25, 2006

Multiple OC4J containers on one server

In development, very often we want to have a controlled, dedicated environment for testing the new codes. This is why sometimes I find having multiple OC4J containers running on a single machine is very helpful. In this way, restarting one container will not affect other “projects”.

One problem with this is port contention. In my Oracle Containers for J2EE 10g (, the HTTP server is running on port 8888, JMS server on port 9127, and RMI server on port 23791 by default.

If run without modification, we will get the following errors:

ERROR jms.xml: port 9,127 already in use

ERROR J2EE RMI0002 Error starting ORMI server atscsun1.sg.oracle.com port 23,791: Address already in use

ERROR J2EE OJR0010 Exception starting HTTP server: Address already in use

The solution I used is to change the port no to other unused port:

1. Change the JMS server  port at $OC4J_HOME/j2ee/home/config/jms.xml:
<jms-server port="9127">

2. Change the RMI server  port at $OC4J_HOME/j2ee/home/config/rmi.xml:

  ssl-port = "23943"

3. Change the HTTP server port at $OC4J_HOME/j2ee/home/config/default-web-site.xml:

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

Save all XML file, start the OC4J, and we are ready to go.