7 Replies Latest reply on Jul 10, 2017 9:52 AM by Gustavo Fernandes

    Infinispan Rest API 1; Hotrod API 0

    Kevin Henry Newbie

      Infinispan 9 offers REST API out-of-the-box, which I was delighted with until I attempted to read the distributed cache via the Hotrod API.


      This is the problem: Used REST API to populate the cache, then attempt to read that content using the Java Hotrod API. In Java, the keys are accessible, but not their values . For example:

      The following XML was POSTed successfully with the URI: http://localhost:8080/rest/default/156211. Issuing a GET returns the aforementioned XML content too.



         <book id="book01">

            <author>Gambardella, Matthew</author>

            <title>XML Developer's Guide</title>




            <description>An in-depth look at creating applications

            with XML.</description>




      However, when using the following Java code:


      import org.infinispan.client.hotrod.RemoteCache;

      import org.infinispan.client.hotrod.RemoteCacheManager;

      import org.infinispan.client.hotrod.configuration.ConfigurationBuilder;

      import org.infinispan.client.hotrod.impl.ConfigurationProperties;


      public static void  main (String[] args) throws ExecutionException, InterruptedException {

        ConfigurationBuilder builder = new ConfigurationBuilder();


        RemoteCacheManager cacheManager = new RemoteCacheManager(builder.build());

        RemoteCache<Object, Object> cache = cacheManager.getCache();


        Set<Object> keySet = cache.keySet();


        Iterator<Object> i = keySet.iterator();

        System.out.println("============= SESSION");

         while (i.hasNext()) {

        Object key = i.next();

        System.out.println("> key=" + key);

        System.out.println("> value=" + cache.get(key));






      The output is:

      ============= SESSION
      > key=156211
      > value=null



      Can anyone enlighten me as to why this occurs?