Hi Nikhil, For point (a), if the objects are stored as java serializable, I believe when deserializing on the server, the class files would need to be on the server class path because at that point it is not pdx serialized.
I think you would need to have the clients serialize with pdx or else you will get this behavior. I am not sure but I don't think the server can automatically convert from java serialization to pdx serialization in this scenario, especially because the information on how to pdx serialize would be contained in the class which isn't on the server. Even if the server knew about the class file, I am not sure if that auto conversion would happen once it has been serialized from the client. Someone that knows pdx a bit better may be able to answer this. -Jason On Thu, Dec 3, 2015 at 10:12 AM, Nikhil Chandrappa <[email protected]> wrote: > Hi, > > *Issue*: > > Unable to query the Gemfire region. I get the following exception > > gfsh>query --query="SELECT firstName FROM /Account WHERE id=1" > > Result : false > startCount : 0 > endCount : 20 > Message : A ClassNotFoundException was thrown while trying to > deserialize cached value. > > NEXT_STEP_NAME : END > > *Context*: > > We are using Spring Data Gemfire caching for storing the cached objects in > to Gemfire. We want to be able to query the Gemfire region to see the cache > data. > > Following are the constraints we have, > > 1. we cannot enable the PDX serializer on the client > 2. Domain objects cannot be placed on the Gemfire server classpath > > *Analysis:* > > *a)* > we have configured Gemfire cluster with PDX serialization, however Gemfire > will store the objects as Java Serialized object. is this a valid behavior? > > *b)* > If we use the query service like below, > > // Log for debugging > > cache.getLogger().info("Executing Query: "+ queryStr); > > SelectResults results = (SelectResults) query.execute(); > > // Log for debugging > > cache.getLogger().info("After Query Execution"); > > I am getting "A ClassNotFoundException was thrown while trying to > deserialize cached value." > > What are the options that we have for querying the regions with constraints > that are mentioned above? We want to able to query the Gemfire regions > without having the domain objects present on the classpath. > > *Configurations:* > > ClientCache.xml > > <?xml version="1.0" encoding="utf-8"?> > <beans xmlns="http://www.springframework.org/schema/beans" > xmlns:cache="http://www.springframework.org/schema/cache" > xmlns:context="http://www.springframework.org/schema/context" > xmlns:gfe="http://www.springframework.org/schema/gemfire" > xmlns:gfe-data="http://www.springframework.org/schema/data/gemfire" > xmlns:p="http://www.springframework.org/schema/p" > xmlns:util="http://www.springframework.org/schema/util" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation=" > http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans.xsd > http://www.springframework.org/schema/cache > http://www.springframework.org/schema/cache/spring-cache.xsd > http://www.springframework.org/schema/context > http://www.springframework.org/schema/context/spring-context.xsd > http://www.springframework.org/schema/gemfire > http://www.springframework.org/schema/gemfire/spring-gemfire.xsd > http://www.springframework.org/schema/data/gemfire > http://www.springframework.org/schema/data/gemfire/spring-data-gemfire.xsd > http://www.springframework.org/schema/util > http://www.springframework.org/schema/util/spring-util.xsd > "> > > > <util:properties id="clientConfigurationSettings"> > <prop key="pivotal.cache.specs.directory">specs</prop> > </util:properties> > > <context:property-placeholder location="classpath:server.properties" > properties-ref="clientConfigurationSettings"/> > > <util:properties id="gemfireCacheConfigurationSettings"> > <prop key="log-level">config</prop> > <prop key="cluster-ssl-enabled">true</prop> > <prop > > key="cluster-ssl-truststore">/Users/nchandrappa/Documents/grid/security/cacerts.keystore</prop> > <prop key="cluster-ssl-truststore-password">password</prop> > </util:properties> > > <gfe:pool id="serverConnectionPool"> > <gfe:locator host="localhost" port="10334"/> > </gfe:pool> > > <gfe:client-cache properties-ref="gemfireCacheConfigurationSettings" > id="gemfireCache" pool-name="serverConnectionPool"/> > > <cache:annotation-driven/> > > <bean id="cacheManager" > > class="pivotal.gemfire.core.cache.manager.RegionCreationGemFireCacheManager" > p:cache-ref="gemfireCache"/> > <bean class="pivotal.gemfire.core.cache.manager.RegionCreator" /> > > <context:component-scan base-package="pivotal.client"/> > > </beans> > > > ServerCache.xml > > <?xml version="1.0"?> > <!DOCTYPE cache PUBLIC > "-//GemStone Systems, Inc.//GemFire Declarative Caching 8.0//EN" > "http://www.gemstone.com/dtd/cache8_0.dtd"> > > <cache> > <pdx read-serialized="true" /> > </cache> > > Thanks, > Nikhil >
