3 Replies Latest reply on Jul 29, 2011 11:19 AM by Mircea Markus

    tomcat simple cluster

    micou micou Newbie



      i develop an application for a server tomcat and actually i would like a simple cache cluster between two tomcat server (machine A and B).


      i try to make cluster local and it work very good but when it is two different machine and i think it is due to a config xml, i do not know.


      i saw this tutorial http://community.jboss.org/wiki/settingupaninfinispancluster but it doesn't solve my problem.


      i try to make a simple programme :

      it is very simple but it works with 2 JVM cluster in local.


          private    Cache cache = null; 

          private    EmbeddedCacheManager cm = null;

          private    TreeCache treecache = null;


          public void init()


              try {

                  cm = new DefaultCacheManager("../../cache.xml");

              } catch (IOException e1) {

                  System.out.println("Cachemanager XML : " + e1.getStackTrack());


              try {

                  cache = cm.getCache();


              catch(Throwable e){

                  System.out.println("getcache error or XML: " + e.getStackTrace());



                  treecache = new TreeCacheFactory().createTreeCache(cache);


              catch(Throwable e){

                  System.out.println("Creation du treecache: "+e.toString());




      i give you my cache.xml and my jgroups-tcp.xml, i hope you can help me because i want a simple utilisation of infinispan between two machine and it is doesnt work, i think because i got a little mistake and i did not see ;/


      when i launch my two tomcat with my api nothing append, they work but they do not have cluster.


      1- is it a problem with conf tomcat xml ?

      2- is it a problem with cache or jgroups-tcp xml ?


      thanks for your help

        • 1. tomcat simple cluster
          micou micou Newbie



          i had this configuration actually:



          | tomcat A  |

          | tomcat B  |


          server one




          | tomcat A  |

          | tomcat B  |


          server two



          all tomcat is clustered and logs is good.


          -cache infinispan tomcat A is clustered with cache infinispan tomcat B and it is ok.

          -cache infinispan tomcat C is clustered with cache infinispan tomcat D and it is ok.



          So i think cache.xml did not take jgroups-tcp.xml configuration i do not have warning in log about it.


          i think he doesnt take parameter in TCPPING with my all ip:port.

          And it is normal when un write wrong paramettre XML in jgroups-tcp i do not have Exception ?


          for this configuration i had:



                <TCPPING initial_hosts="[7800],[7801],[7800],[7801] "








          thanks for you help

          • 2. Re: tomcat simple cluster
            Manik Surtani Master

            Did you try using UDP instead of TCP, if your environment supports UDP multicast?

            • 3. Re: tomcat simple cluster
              Mircea Markus Master

              as per yor jgroups-tcp.xml you bind the servers on port 7882:




              The discovery (TCPPING) should also try to run in the same range, i.e. 7880 and not 7800.

              I can't see how the cluster forms even on the same machine..