Results 1 to 3 of 3

Thread: POJO Mapping in spring-data-gemfire 1.2.M1

  1. #1
    Join Date
    Jan 2012
    Posts
    5

    Default POJO Mapping in spring-data-gemfire 1.2.M1

    hello 1st of 2 posts,

    I have started playing around with the new repository features in 1.2.M1 and have found that gemfire is only happy if the object I am trying to save in the repository is both Serializable and Cloneable. however I don't see this stated as requirement in the documentation. is this an omission in the doco or a config problem on my part?

    error below:

    Exception in thread "main" java.lang.IllegalArgumentException: Class class pkg.Request was not Cloneable nor Serializable
    at com.gemstone.gemfire.CopyHelper.copy(CopyHelper.ja va:92)
    at com.gemstone.gemfire.internal.cache.LocalRegion.co nditionalCopy(LocalRegion.java:1330)
    at com.gemstone.gemfire.internal.cache.TXState.getDes erializedValue(TXState.java:1162)
    at com.gemstone.gemfire.internal.cache.TXStateProxyIm pl.getDeserializedValue(TXStateProxyImpl.java:180)
    at com.gemstone.gemfire.internal.cache.LocalRegion.ge t(LocalRegion.java:1193)
    at com.gemstone.gemfire.internal.cache.AbstractRegion .get(AbstractRegion.java:234)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.data.gemfire.GemfireTemplate$C loseSuppressingInvocationHandler.invoke(GemfireTem plate.java:410)
    at $Proxy7.get(Unknown Source)
    at org.springframework.data.gemfire.GemfireTemplate$6 .doInGemfire(GemfireTemplate.java:149)
    at org.springframework.data.gemfire.GemfireTemplate.e xecute(GemfireTemplate.java:339)
    at org.springframework.data.gemfire.GemfireTemplate.e xecute(GemfireTemplate.java:323)
    at org.springframework.data.gemfire.GemfireTemplate.g et(GemfireTemplate.java:146)
    at org.springframework.data.gemfire.repository.suppor t.SimpleGemfireRepository.findOne(SimpleGemfireRep ository.java:71)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.data.repository.core.support.R epositoryFactorySupport$QueryExecutorMethodInterce ptor.executeMethodOn(RepositoryFactorySupport.java :323)
    at org.springframework.data.repository.core.support.R epositoryFactorySupport$QueryExecutorMethodInterce ptor.invoke(RepositoryFactorySupport.java:308)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :172)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:202)
    at $Proxy15.findOne(Unknown Source)
    at pkg.RequestService.confirmRequestorIdentityPreserv ed(RequestService.java:39)
    at pkg.RequestService$$FastClassByCGLIB$$69d81da8.inv oke(<generated>)
    at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy. java:149)
    at org.springframework.aop.framework.Cglib2AopProxy$C glibMethodInvocation.invokeJoinpoint(Cglib2AopProx y.java:689)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :150)
    at org.springframework.transaction.interceptor.Transa ctionInterceptor.invoke(TransactionInterceptor.jav a:110)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :172)
    at org.springframework.aop.framework.Cglib2AopProxy$D ynamicAdvisedInterceptor.intercept(Cglib2AopProxy. java:622)
    at pkg.RequestService$$EnhancerByCGLIB$$49ad27b2.conf irmRequestorIdentityPreserved(<generated>)
    at pkg.Main.main(Main.java:42)

    cheers

  2. #2
    Join Date
    Oct 2004
    Location
    Berwyn, PA
    Posts
    56

    Default

    I Agree the docs are not clear on this point. By default Gemfire will use java serialization. Note serialization is only an issue if you are configured for persistence or require remoting (e.g. to a cache server) You can also configure the cache to use Gemfire's proprietary Pdx serialization which is language portable and efficient. This should work with the repository. (I'm not sure about the cloneable issue. That may be specific to your configuration):

    {code:xml}
    <gfe:cache properties-ref="cache-props" pdx-read-serialized="true" pdx-persistent="true" pdx-serializer="pdx-serializer"/>
    <bean id="pdx-serializer" class="org.springframework.data.gemfire.mapping.Ma ppingPdxSerializer">
    <constructor-arg name="mappingContext">
    <bean class="org.springframework.data.gemfire.mapping.Ge mfireMappingContext"/>
    </constructor-arg>
    <constructor-arg name="conversionService">
    <bean class="org.springframework.core.convert.support.De faultConversionService"/>
    </constructor-arg>
    </bean>
    {code}

    There are some enhancements coming in 1.2 which will make make Pdx easier to use.
    David Turanski
    SpringSource Senior Software Engineer

  3. #3
    Join Date
    Jan 2012
    Posts
    5

    Default

    hey, thanks for both your replies this morning. they were very helpful.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •