2 Replies Latest reply on Jul 9, 2015 11:46 AM by Nicolas V.

    Enabling compatibility doesn't seems to do anything ?

    Nicolas V. Newbie

      Hello, I am a total newbie with infinispan, but features feets my needs.


      I am using a C++ HotRod client with a Java embedded HotRot endpoint with cache, and when I am putting K/V the java cache listener throw an exception about cast error between B[ and String.


      I found that I amy have to enable compatibility mode, so I did, but it doesn't to seems to do anything.


      Here my code :


      Main java software :


      public static void main(final String[] args)
           final EmbeddedCacheManager manager = new DefaultCacheManager();
           final PersistenceConfigurationBuilder persistConfig = new ConfigurationBuilder().persistence();
           final SingleFileStoreConfigurationBuilder fileStore = new SingleFileStoreConfigurationBuilder(persistConfig).location("cache");
           final Configuration config = persistConfig.addStore(fileStore).build();
           manager.defineConfiguration("records", config);
           final Cache<String, String> c = manager.getCache("records");
           c.addListener(new CacheListener());
           new HotRodServer().start(new HotRodServerConfigurationBuilder().build(), manager);
                catch(final InterruptedException e)


      My cache listener :


      public void observeAdd(final CacheEntryCreatedEvent<Object, String> event)
           System.err.println("new entry : " + event.getKey() + " -> " + event.getValue());


      Extract of the exception :


      Caused by: java.lang.ClassCastException: [B cannot be cast to java.lang.String

                      at recordprocessing.CacheListener.observeAdd(CacheListener.java:38) ~[classes/:na]

                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_25]

                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_25]

                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_25]

                      at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0_25]

      at org.infinispan.notifications.impl.AbstractListenerImpl$ListenerInvocationImpl$1.run(AbstractListenerImpl.java:286) ~[infinispan-core-7.2.3.Final.jar:7.2.3.Final]

                      ... 60 common frames omitted



      My c++ hotrod client is exactly from the documentation :


      #include "infinispan/hotrod/ConfigurationBuilder.h"
      #include "infinispan/hotrod/RemoteCacheManager.h"
      #include "infinispan/hotrod/RemoteCache.h"
      #include <stdlib.h>
      using namespace infinispan::hotrod;
      int main(int argc, char** argv)
           ConfigurationBuilder b;
           RemoteCacheManager cm(builder.build(), false);
           RemoteCache<std::string, std::string> cache = cm.getCache<std::string, std::string>(std::string("records"));
           std::string k1("key13");
           std::string v1("boron");
           rc.put(k1, v1);
           return 0;



      What do I do wrong ? and what needs to be changed to make this code works ?





      Best regards.