2 Replies Latest reply on Jul 25, 2011 5:09 AM by Pete Muir

    Not having luck with basic clustering setup in JBoss AS 6

    Mark DeSpain Newbie

      Just trying to get a basic clustering setup going in JBoss AS 6, and I'm relying on the Infinispan that comes with it, which I believe is version 4.2.0.FINAL.  However, I'm not having much luck.  I belive I've set the cache up for replication and log messages indicate that the nodes can see each other.  However, items which are put into the cache on one node do not end up being accessible from the cache on another node. 

       

      Might anyone be able to tell me where I've gone astray or help me bottom out on this?

       

       

      Here is my initialization code for the CacheManager:

       

      public class CacheConstant

      {

                public static final DefaultCacheManager CACHE_MANAGER;

                static

                {

                          GlobalConfiguration globalConfig = GlobalConfiguration.getClusteredDefault();

                          Configuration c = new Configuration();

      c.setCacheMode( CacheMode.REPL_SYNC );

                          CACHE_MANAGER =          new DefaultCacheManager( globalConfig, c );

                }

      }

       

      Here is a trivial EJB implementation that is exposed through JAX-RS (RestEasy).

       

      @Stateless

      @Local( SimpleCache.class )

      public class SimpleCacheBean implements SimpleCache

      {

                @Override

                public void put(String key, String value) {

                          CacheConstant.CACHE_MANAGER.getCache().put(key, value);

                }

       

       

                @Override

                public String get(String key) {

                          return (String) CacheConstant.CACHE_MANAGER.getCache().get(key);

                }

      }

       

      For completeness, here it the SimpleCache interface:

       

      @Path("cache")

      @Produces({ "application/json" })

      public interface SimpleCache

      {

                @Path("/{key}/{value}")

                @PUT

                void put( @PathParam("key") String key, @PathParam("value") String value );

       

                @Path("/{key}")

                @GET

                String get( @PathParam("key") String key );

      }