Overview

Geronimo now has some basic support for SFSB clustering. If you would like to give it a try then here are some instructions.

Create a clustered EJB module.

I have done some testing with an OpenEJB example, namely CounterImpl, that you can co from https://svn.apache.org/repos/asf/openejb/trunk/openejb3/examples/simple-stateful. Note that you need to update CounterImpl so that it implements Serializable.
And here is the geronimo-opejnejb.xml plan I am using:

<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns="http://geronimo.apache.org/xml/ns/j2ee/ejb/openejb-2.0"
   xmlns:wadi="http://geronimo.apache.org/xml/ns/openejb-clustering-wadi-1.2">
   <environment>
       <moduleId>
           <groupId>org.codehaus.wadi</groupId>
           <artifactId>wadi-openejb</artifactId>
           <version>2.0-SNAPSHOT</version>
           <type>jar</type>
       </moduleId>
   </environment>
  <wadi:openejb-clustering-wadi>
      <wadi:deltaReplication>false</wadi:deltaReplication>
  </wadi:openejb-clustering-wadi>
</ejb-jar>

Deploy clustering EJB Module

Create and start an additional Geronimo Server

Test the clustered SFSBs

If you are also using CounterImpl, then you can use this snippet:

       Properties properties = new Properties();
       properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
       properties.setProperty(Context.PROVIDER_URL, "ejbd://0.0.0.0:4201");
       InitialContext remoteContext = new InitialContext(properties);

       CounterRemote counterRemote = (CounterRemote) remoteContext.lookup("CounterImplRemote");
       int cpt = counterRemote.increment();
       System.out.println(cpt);
       cpt = counterRemote.increment();
       System.out.println(cpt);
       cpt = counterRemote.increment();
       System.out.println(cpt);

To actually trial the clustering:

  1. put a breakpoint on the last increment;
  2. kill -9 the 'default' Geronimo Server
  3. continue your debug session. 3 should be printed.

This is a test demonstrating replication.