Running multiple JOnAS servers

If you want to run several JOnAS servers, there are many configurations that you can setup according to your needs.

Autonomous servers

In this case, each JOnAS server runs independently of the others and has its own JNDI and JTM services. If those servers share the same database and you use entity beans, make sure that the shared flag in your beans deployment descriptor is set to true. Check the JOnAS Beans developer guide for more information.

Distributing the beans over several servers

Clustering with JOnAS is not yet available, however you can distribute your beans across several JOnAS servers. To achieve this you have to share a JEREMIE JNDI (this is not possible with RMI that does not allow to remotely bind objects) and a JTM. This configuration is depicted in Figure 1.

Figure 1. Example of two JOnAS servers with a centralized JNDI and JTM

Everything can be setup with proper jonas.properties files.

Here is how to setup a JOnAS server named jonas1 hosting the JNDI, the JTM and 2 beans:

jonas.name	              jonas1
jonas.services	              jtm,dbm,ejb
jonas.registry                collocated
jonas.service.ejb.descriptors bean1.xml,bean2.xml
jonas.service.jtm.remote      false

The second server named jonas2 accesses the JNDI and the JTM remotely and loads 2 other beans:

jonas.name	              jonas2
jonas.services	              jtm,dbm,ejb
jonas.registry                remote
jonas.service.ejb.descriptors bean3.xml,bean4.xml
jonas.service.jtm.remote      true

Make sure that you use the same jndi.properties file that should look like (assuming that jonas1 is running on node1.mycompany.com):

java.naming.factory.initial	org.objectweb.jeremie.libs.services.registry.jndi.JRMIInitialContextFactory
java.naming.provider.url	jrmi://node1.mycompany.com:12340
java.naming.factory.url.pkgs	org.objectweb.jonas.naming