1

I have the client side working, looks like everything is alright. I can save the object and retrieve the object back from the client side.

However, if i am trying to use gfsh or data browser to view the data, i got this exception on gfsh

Message : Could not create an instance of a class com.room.backend.soa.spring.cache.geode.test.domain.Book
Result  : false

and on data browser

javalangException- Query could not be executed due to - orgapachegeodepdxPdxSerializationException- Could not create an instance of a class comroombackendsoaspringcachegeodetestdomainBook

My code is like this

    ClientCacheFactoryBean gemfireCache = new ClientCacheFactoryBean();
    gemfireCache.setClose(true);
    gemfireCache.setProperties(gemfireProperties);
    gemfireCache.setPdxSerializer(pdxSerializer);

pdxSerializer is

    ReflectionBasedAutoSerializer serializer =
            new ReflectionBasedAutoSerializer(
                    "com.room.backend.soa.spring.cache.geode.test.domain.*",
                    "com.room.backend.soa.spring.cache.geode.test.domain.Book",
                    "com.room.backend.soa.spring.cache.geode.test.domain.Book#identity=id.*",
                    "com.room.backend.soa.spring.cache.geode.test.domain.#identity=id.*"

                    );
Jackie
  • 25,199
  • 6
  • 33
  • 24
  • I think you have to register the pdx type in the cache like I did [here](https://stackoverflow.com/questions/45793610/registering-pdx-type-in-type-registry-with-geode-c-sharp-native-client) – rupweb Oct 26 '17 at 16:06

1 Answers1

2

You need to run the gfsh>configure pdx --read-serialized=true command. This should be done after starting the locator, but before starting the servers. Please refer to this docs page for details.

Swapnil
  • 1,191
  • 7
  • 8
  • Exactly i have found out as well. Thanks. out of curiosity though, you know why the configure is not turned on by default ? – Jackie Oct 30 '17 at 11:01
  • If you have installed callbacks on the server (CacheListeners/CacheWriters etc) you will have to work with PDXInstance in those callbacks rather than the domain objects. Since this an explicit decision that the user has to make, read-serialized is not turned on by default. – Swapnil Oct 30 '17 at 12:14