Child pages
  • Test Drive Geronimo EJB Clustering

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3


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.

  • SFSBs must implement Serializable even if they are EJB3 SFSBs.
  • In the geronimo-openejb DD, include the 'openejb-clustering-wadi' element.

I have done some testing with an OpenEJB example, namely CounterImpl, that you can co from Note that you need to update CounterImpl so that it implements Serializable.
And here is the geronimo-opejnejb.xml plan I am using:

Code Block
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns=""

Deploy clustering EJB Module

Create and start an additional Geronimo Server

  • To create another instance, say NODE2, you can execute the following commands from the Geronimo install dir:

    mkdir NODE2
    cp -r var NODE2
    perl -pi -e 's/PortOffset=0/PortOffset=1/' NODE2/var/config/
    perl -pi -e 's/clusterNodeName=NODE/clusterNodeName=NODE2/' NODE2/var/config/

  • To start this instance, within gshell type:

    geronimo/start-server -G -b

Test the clustered SFSBs

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

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

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

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.