OC4J Instance Startup Dependencies
Saturday, August 22nd, 2009(Originally posted on “old” Jason Bennett’s Developer Corner, Sunday, August 05, 2007)
OracleAS 10g can be configured to allow startup dependencies between OC4J instances. In other words, OC4J instance OC4J_B cannot start until OC4J instance OC4J_A has started. This is along the same lines as one MS Windows service being dependant on another at startup. This is useful (and necessary) if OC4J instance OC4J_A contains services that provide some sort of critical data that some application in OC4J instance OC4J_B needs as part of its initialization. The only catch to this is that the OC4J instances can’t be located within the same ias-component. An ias-component consists of one or more process-types. An example of a process-type would be an OC4J instance. For example, every time you create a new OC4J instance using dcmctl or OracleAS 10g Enterprise Manager, it is placed under the ias-component called “OC4J”. Other examples of common ias-components are: LogLoader, dcm-daemon, HTTP_Server, and WebCache. Executing the command “opmnctl status” will give a listing of each ias-component and the name of each process-type associated with it.
The easiest way to create a new ias-component and associated OC4J instance (or process-type) with a dependency on another OC4J instance is:
1. Create a new OC4J instance (process-type) using dcmctl or OracleAS Enterprise Manager (skip this step if you plan on moving an existing OC4J instance).
2. Open the opmn.xml file and create a new ias-component entry (make sure you back-up the existing file and shutdown opmn before doing this !)
<ias-component id=”My Custom Component”>
…
</ias-component>
3. Locate the OC4J instance you created in step-one (it should be under the “OC4J” ias-component). Cut the entire tag set defining the OC4J instance (process-type) and paste it into your new ias-component (You can also do this with an existing OC4J instance):
<ias-component id=” My Custom Component “>
<process-type id=”OC4J_B” module-id=”OC4J”>
<module-data>
<category id=”start-parameters”>
<data id=”java-options” value=”-server -Djava.security.policy= /app/oracle/product/10.1.2/midtier/j2ee/ OC4J_B /config/java2.policy -Djava.awt.headless=true”/>
<data id=”oc4j-options” value=”-properties”/>
</category>
<category id=”stop-parameters”>
<data id=”java-options” value=”-Djava.security.policy= /app/oracle/product/10.1.2/midtier/j2ee/ OC4J_B /config/java2.policy -Djava.awt.headless=true”/>
</category>
</module-data>
<start timeout=”900″ retry=”2″/>
<stop timeout=”120″/>
<restart timeout=”720″ retry=”2″/>
<port id=”ajp” range=”12501-12600″/>
<port id=”rmi” range=”12401-12500″/>
<port id=”jms” range=”12601-12700″/>
<process-set id=”default_island” numprocs=”1″/>
</process-type>
</ias-component>
4. To define the dependency between the OC4J instance defined under your new ias-component and another OC4J instance defined under a different ias-component, you need to add a dependency definition under the ias-component tag:
<ias-component id=” My Custom Component “>
<dependencies>
<managed-process ias-component=”OC4J” process-type=”OC4J_A” process-set=”default_island” autostart=”true” />
</dependencies>
<process-type id=”OC4J_B” module-id=”OC4J”>
<module-data>
<category id=”start-parameters”>
<data id=”java-options” value=”-server -Djava.security.policy= /app/oracle/product/10.1.2/midtier/j2ee/ OC4J_B /config/java2.policy -Djava.awt.headless=true”/>
<data id=”oc4j-options” value=”-properties”/>
</category>
<category id=”stop-parameters”>
<data id=”java-options” value=”-Djava.security.policy= /app/oracle/product/10.1.2/midtier/j2ee/ OC4J_B /config/java2.policy -Djava.awt.headless=true”/>
</category>
</module-data>
<start timeout=”900″ retry=”2″/>
<stop timeout=”120″/>
<restart timeout=”720″ retry=”2″/>
<port id=”ajp” range=”12501-12600″/>
<port id=”rmi” range=”12401-12500″/>
<port id=”jms” range=”12601-12700″/>
<process-set id=”default_island” numprocs=”1″/>
</process-type>
</ias-component>
5. Save the opmn.xml file and start up opmn and all of its processes.
That’s all there is to it! Now OC4J_B will not start until OC4J_A has started.

