2 Replies Latest reply on Jul 16, 2013 7:55 PM by Tommy T

    Clustered Cache - Transport not defined

    Tommy T Newbie

      Hi,

       

      I am trying to configure a distributed cache. I have two jboss servers running in domain mode (two servers on one Jboss instance). I am trying to modify the CDI quickstart but the (current!!) error is

       

       

      {code}JaxRsActivator threw exception: org.jboss.resteasy.spi.UnhandledException: org.infinispan.config.ConfigurationException: Cache cannot use a clustered mode (DIST_ASYNC) mode and not define a transport! {code}


       

       

       

      I have pasted my code below...how can i set the Transport mode or modify my code to use the pattern taken from the quickstart?

       

      My code:

       

       

      {code}

      @Qualifier

      @Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD})

      @Retention(RetentionPolicy.RUNTIME)

      @Documented

      public @interface UserCache {

      }

      {code}

       

       

       

       

      config/producer

       


      {code}

      public class Config {

       

                @Inject

                Logger logger;

       

      //*********code from quickstart

      //    @ConfigureCache("user-cache") // This is the cache name.

      //    @UserCache // This is the cache qualifier.

      ////    @ApplicationScoped

      //    @Produces

      //    public Configuration userCacheConfiguration() {

      //        return new ConfigurationBuilder()

      //                    .eviction()

      //                        .strategy(EvictionStrategy.LRU)

      //                        .maxEntries(100000)

      //                    .build();

      //    }

           @Produces

                @ApplicationScoped

                @UserCache

                public Cache<String, Long> configureCacheManager() {

                          logger.info("  producing user cache....");

       

      EmbeddedCacheManager manager= new DefaultCacheManager(); 

              manager.defineConfiguration("user-cache", new ConfigurationBuilder()

                      .eviction().strategy(EvictionStrategy.LIRS).maxEntries(100000)

                      .clustering().cacheMode(CacheMode.DIST_ASYNC)

                      .build());

       

       

              Cache<String, Long> cache = manager.getCache("user-cache");

              logger.info("returning user cache...."+cache.getName());

              return cache;

                }

      {code}

       

       

       

       

      service using the cache

       

       

      {code}

      public class UserCacheService {

       

                @Inject

                Logger logger;

       

                   @CachePut(cacheName = "user-cache")

                   public void login(@CacheKeyParam String cookieValue, @CacheValue Long userId) {

                      logger.info(" *********** Logging in user into cache map : "+ userId);

                   }

       

       

      }

      {code}

       

       

       

      Thanks,

      T