|Home > Documentation > Configuring and administering > Configuring and administering the Apache Geronimo Server > Clustering and farming > EJB failover|
In Geronimo, you can configure OpenEJB for failover scenarios, such as multipoint and multicast. Further more, Geronimo uses WADI to support failover for Stateful Session Bean (SFSB) in a unicast way.
By default, OpenEJB can use either multicast or multipoint strategies for failover scenarios. Basically the server cluster members maintain membership information using heartbeats and the ejb client maintains a list of servers to change target server based on availability. Each heartbeat packet contains a single URI that advertises a service, its cluster group, and its location in the form of "cluster1:ejb:ejbd://thehost:4201".
By updating different attributes in the config-substitutions.properties file, you can choose the appropriate discovery strategies in your cluster.
Note that for multicast scenario, you have to set openejb.client.requestretry property to true when starting up the Geronimo server. For example
EJB clients must know the address of EJB members to make sure that its request will be handled with high availability, regardless of whether EJB members are clustered in a Multipoint or Multicast way.
See the following code snippet for your client application development for remote host lookup.
OpenEJB supports 3 kinds of failover strategies when the original node was shut down abnormally.
You can configure unicast-based support for EJB clustering. WADI can be configured to use unicast instead of multicast to support failover for Stateless Session Bean.
The following server configurations, shipped out-of-the-box with the Java EE assemblies, must be installed and enabled for the unicast EJB failover to work:
This configuration must be running when a cluster is started. If it is not, then the substitution group openejb-clustering-wadi is not properly recognized and the deployment fails.
To enable unicast-based failover for Stateless Session Bean, the wadi-clustering module in <GERONIMO_HOME>/var/config/config.xml should be configured for each server node. You must specify the real IP address to ServerHostname and the node name to ClusterNodeName for each static member in the config-substitutions.properties file. Each member has its own GBean configuration in the wadi-cluster module in config.xml. Ensure that you define all the static members in it. The following example shows the configuration with two static members.
Node1_IP is the IP address of the first server node.
Node2_IP is the IP address of the second server node.
The Geronimo-specific deployment plan for an EJB application, which is usually packaged as an EJB JAR file, is called "openejb-jar.xml". The openejb-jar.xml deployment plan is used in conjunction with the ejb-jar.xml Java EE deployment plan to deploy enterprise applications to the Geronimo application server.
To enable WADI configuration for your application, add openejb-clustering-wadi into the deployment plan as follows:
An application client must find an EJB node and make sure that the client could find another node when the original one was shut down abnormally in a unicast scenario. Use the following code snippet when programming your client applications.