-
1. Re: RemoteCache data is null when using programmatic server configuration
nadirx Dec 15, 2014 1:09 AM (in response to scpark)1 of 1 people found this helpfulYou need to enable compatibility mode and provide appropriate datacontainer equivalence classes. Look at tristantarrant/infinispan-playground-embedded-hotrod · GitHub for a working example.
-
2. Re: RemoteCache data is null when using programmatic server configuration
scpark Dec 15, 2014 2:00 AM (in response to nadirx)Thanks for reply..
But when I enable compatibility mode, I think I need to write and define marshaller for VO(Value Object) that inserted as a value.
Also Infinispan-server's standalone.xml and clustered.xml does not contain <compatibility enabled="true"/> and works fine.
Why should I enable compatibility mode? and if compatibility is necessary mode, can i enable it without marshaller?
-
3. Re: RemoteCache data is null when using programmatic server configuration
nadirx Dec 15, 2014 2:24 AM (in response to scpark)You need compatibility mode because you are writing from embedded and reading from HotRod.
In Infinispan Server you are only accessing the data remotely over a single protocol and therefore you do not need to enable compatibility mode. Server does however enable datacontainer equivalence using the same class that is in my example.
As for the marshaller, you don't need to write your own: you can use the included GenericJBossMarshaller. Also, if you're using the "embedded server" approach, enabling compatibility mode will ensure the marshaller is applied to the data when it is being accessed over HotRod. In this case the embedded side will only see the "real" (unmarshalled) object.
-
4. Re: Re: RemoteCache data is null when using programmatic server configuration
scpark Dec 15, 2014 4:15 AM (in response to nadirx)Resolved this issue.
Configuration config = new org.infinispan.configuration.cache.ConfigurationBuilder()
.clustering().cacheMode(CacheMode.LOCAL)
.sync()
.jmxStatistics().enable()
.dataContainer().keyEquivalence(new AnyServerEquivalence()).valueEquivalence(new AnyServerEquivalence())
//.dataContainer().keyEquivalence(ByteArrayEquivalence.INSTANCE).valueEquivalence(ByteArrayEquivalence.INSTANCE)
.build();
Special thanks @Tristan Tarrant.