Announcement Announcement Module
No announcement yet.
PDXSerializer Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • PDXSerializer

    I'm trying to set gemfire cache with pdx-serializer with the new attribute that included in the latest spring-gemfire release , but always fail with error message "Invalid pdx serializer usedclass java.lang.String is not assignable to interface com.gemstone.gemfire.pdx.PdxSerializer" .

    Below is the configuration of gemfire cache and the error information :
    <gfe:cache pdx-read-serialized="true" pdx-serializer="cacheSerializer" />

    <bean id="cacheSerializer" class="com.gemstone.gemfire.pdx.ReflectionBasedAut oSerializer">
    <constructor-arg ref="serializedClasses"></constructor-arg>

    <util:list id="serializedClasses" list-class="java.util.ArrayList" value-type="java.lang.String">
    <value>com.anabatic.zeus.core.intf.SessionContex t</value>
    <value>com.anabatic.zeus.core.intf.ObjectMessage </value>

    Caused by: java.lang.IllegalArgumentException: Invalid pdx serializer usedclass java.lang.String is not assignable to interface com.gemstone.gemfire.pdx.PdxSerializer
    at org.springframework.util.Assert.isAssignable(Asser
    at applyPdxOptions(
    at afterPropertiesSet(
    at AutowireCapableBeanFactory.invokeInitMethods(Abstr
    at AutowireCapableBeanFactory.initializeBean(Abstract
    ... 16 more

    Any idea how to get spring-gemfire work with pdx-serializer? I couldn't found any guideline from the spring-gemfire user manual related this new attribute

  • #2
    Looks like you've run into a bug. Your configuration is fine - is just that the namespace handler consider the bean name rather then its reference as its target. A fix has been pushed into master - I've also triggered the nightly build so you can try it in 10 minutes or so.

    As an alternative you can use the plain bean definition rather then the namespace as a workaround - from the top of my head:

    <bean id="gemfire-cache" class="org.springframework.gemfire.CacheFactoryBean" p:pdx-read-serialized="true" 
    (note this uses the p: namespace - see the Spring docs or google for more info if you're not familiar with it).


    • #3
      Nightly build triggered:


      • #4
        Already try the workaround and the initialization process is fine, but still couldn't get the pdx serializer working as expected, cache writer doesn't recognize the pdx serializer.

        Currently I'm creating custom serializer that work perfectly fine, just need to figure out how to make the serializer recognize new class without manually add it into the supported class list while the serializer actually able to serialize object dynamically similar to the reflection based pdx-serializer


        • #5
          I don't know what to tell you - it might be a GemFire specific topic. It's worth checking (with the docs or GemFire forum) whether the pdx will be used only at the cache level or through-out the infrastructure (like the cache/loader/writer) as well.


          • #6
            until the bugfix is in the RELEASE (and not SNAPSHOT), i work around it using SpEL "eval" hack:

            <gfe:cache pdx-read-serialized="true" pdx-serializer="#{cacheSerializer}" />


            • #7
              The PdxSerializer interface allows domain classes to be serialized and deserialized as PDXs without modification of the domain class. It only requires that the domain class have a public zero-arg constructor and that it provides read and write access to the PDX serialized fields.

              Gem Fire allows a single PdxSerializer to be configured on a cache using setPdxSerializer or client setPdxSerializer. It can also be configured in cache.xml using the pdx-serializer element. The same PdxSerializer should be configured on each member of a distributed system that can serialize or deserialize PDX data.


              • #8
                Thanks for your guidance! try it now.