0 Replies Latest reply on Mar 28, 2011 9:37 AM by Ciprian Stoica

    Hibernate Second Level cache not working properly on Jboss 5.1 cluster

    Ciprian Stoica Newbie

      Hi,

       

      I try to set-up JBoss Cache 2 as a Hibernate Second Level Cache on Jboss 5.1.G.A. As a reference I use the document from here: www.jboss.org/jbossclustering/docs/hibernate-jbosscache-guide-3.pdf.

      I run Jboss in a cluster which consists on two Linux machines (RHEL 4 and Ubuntu 10).

      My hibernate.cfg.xml contains these lines:

       

      <?xml version='1.0' encoding='UTF-8'?>

      <!DOCTYPE hibernate-configuration PUBLIC

                "-//Hibernate/Hibernate Configuration DTD 3.0//EN"

                "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

       

      <hibernate-configuration>

       

          <session-factory>

              <property name="connection.username">root</property>

              <property name="connection.password">root</property>

              <property name="connection.url">jdbc:mysql://192.168.223.169:3306/hibtest</property>

              <property name="dialect">org.hibernate.dialect.MySQLDialect</property>

              <property name="connection.driver_class">com.mysql.jdbc.Driver</property>

              <property name="hibernate.show_sql">true</property>

              <property name="hibernate.format_sql">true</property>

       

              <property name="hibernate.cache.region.factory_class">org.hibernate.cache.jbc2.MultiplexedJBossCacheRegionFactory</property>

              <property name="hibernate.cache.use_second_level_cache">true</property>

              <property name="hibernate.cache.use_query_cache">true</property>

              <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>

       

              <mapping resource="ro/memiq/training/hibernate/Usr.hbm.xml"></mapping>

              <mapping resource="ro/memiq/training/hibernate/Address.hbm.xml"></mapping>

       

          </session-factory>

       

      </hibernate-configuration>

       

      The cluster starts properly and according to documentation the cache should work properly too. But unfortunately it doesn't. When I read an entity on one node, the I delete it on the other node, then I re-read it on the first node, the entity is still displayed on the first node. The cache on the nodes doesn't synchronize.

       

      I suppose I make a mistake somewhere but I don't see where. If you need more details about the project configuration I will post the here.

       

      Many Thanks,

      Ciprian