0 Replies Latest reply on Mar 28, 2007 1:07 PM by Ian Fallon

    JBoss and clustering basics

    Ian Fallon Newbie

      Hi all,

      At the risk of posting some really stupid questions ...

      I need to create a redundant system with no single point of failure with 2 machines, each running an instance of JBoss and MySQL. These should be symmetric such that if one goes down the other handles requests and the DBs stay in sync. They should also share load if both are up.

      I am trying to use EJB3+JBoss(clustered)+MySQL to achieve this. (Good or bad idea ?!)

      I have tried to setup a simple system to gain an understanding of the myriad of bits of JBoss/Hibernate/JBCache/MySQL technology involved and all the XML fragments etc etc that need to all be in line.

      I have installed the 2 machines (Windows for now) with identical JBoss 4.0.5GA app servers (ejb3-cluster deployment) and MySQL 4.1.2.
      I have trawled through so so many bits of docs and seemingly have the XML and code annotations in place for the system to cache some simple entities.

      Machine A has a populated DB and machine B has an empty DB.

      The cluster seems to come up correctly and I make a client call on machine A. The cache on A is populated (according the JMX console) and the correct results returned. The cache on B also updates (as seen in the JMX console) but client requests on machine B always return what is in the DB (i.e. nothing), not what is in the cache! So it looks like Hibernate is not using the cache.

      Here is my persistence.xml file:

       <persistence-unit name="ejb3trail">
       <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
       <property name="hibernate.cache.use_query_cache" value="true"/>
       <property name="hibernate.show_sql" value="true"/>
       <property name="hibernate.hbm2ddl.auto" value="update"/>
       <property name="hibernate.connection.datasource" value="java:/TestDS"/>
       <property name="hibernate.cache.provider_class" value="org.jboss.ejb3.entity.TreeCacheProviderHook"/>
       <property name="hibernate.treecache.mbean.object_name" value="jboss.cache:service=EJB3EntityTreeCache"/>

      Any help appreciated I am at the end of my patience! also, are there any top level overviews of this stuff with answers to "obvious" questions like: Do you have to replicate the DB separately from the cache ? Or should the cache be writing changes to entities back to the DB ?

      Also any pointers or references to help decide what is the best set of technologies (some proven examples would be great) to use for a clustered Java/DB solution would be really helpful before we decide the EJB3/JBoss route.

      Best regards and thanks in advance,