|
Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide
10g Release 3 (10.1.3) B14428-01 |
|
![]() Previous |
![]() Next |
The general procedure for configuring EJB application clustering for an EJB 3.0 or EJB 2.1 stateful session bean is:
Configure your OC4J application cluster (see "Application Clustering in OC4J" in the Oracle Containers for J2EE Configuration and Administration Guide).
Configure a replication policy for stateful session beans on each node (see "Using Deployment XML"):
Deploy your EJB to any one of the nodes in the cluster.
For more information, see "State Replication".
To configure a replication policy, add a <replication-policy> element to one or more of the appropriate deployment descriptor files that Table 24-1 lists.
You can specify a single replication policy that OC4J applies globally or specify finer-grained replication policy at the application level for both Web and EJB components or EJB components only.
Configure the trigger attribute to one of the following:
onRequestEnd — replicate at the end of each EJB method call
onShutdown — replicate when the JVM is terminating normally
The scope attribute is always set to allAttributes for a stateful session bean.
For more information, see "State Replication Trigger".
Table 24-1 Deployment XML Files for Replication Policy Configuration
| Scope | Affected Components | Deployment XML File | See also ... |
|---|---|---|---|
|
Global |
Web and EJB |
|
"Configuring Global Replication Policy in the application.xml File for Web and EJB Components" |
|
Application-level |
Web and EJB |
|
|
|
Application-level |
EJB |
|
"Overriding Application-Level Replication Policy in the orion-ejb-jar.xml File for EJB Components" |
When you configure the application.xml file with a state replication policy (see Example 24-1), it applies to all Web components and to all stateless session beans deployed to this instance of OC4J.
When you configure the orion-application.xml file with a state replication policy (see Example 24-2), it applies to all Web components and to all stateless session beans deployed to this instance of OC4J.
When you configure the orion-ejb-jar.xml file with a state replication policy for a stateful session bean (see Example 24-3), each bean can use a different type of replication independent of the Web component replication type.
Example 24-3 The orion-ejb-jar.xml For an Application-Level Replication Policy for EJBs
<orion-ejb-jar> ... <session-deployment name="AirlinePOEndpointBean" max-tx-retries="0" location="AirlinePOEndpointBean" persistence-filename="AirlinePOEndpointBean"> ... <replication-policy trigger="onRequestEnd" scope="allAttributes" /> ... </session-deployment> ... </orion-ejb-jar>