This discussion is archived
2 Replies Latest reply: Apr 30, 2013 11:57 AM by brianorwig RSS

SimplePofPath not serializable

brianorwig Newbie
Currently Being Moderated
I am running into serialization issues when using POFExtractors and filteres with Coherence 3.7.1.6. I am getting the following error when trying to do a filtered search on the keys:
 
 Caused by: java.io.NotSerializableException: com.tangosol.io.pof.reflect.SimplePofPath
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1180)
        at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
        at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
        ....
In my POFConfig.xml I have the following:
 
    <user-type>
      <type-id>1002</type-id>
      <class-name>com.myClass.MyPOFObject</class-name>
      <serializer>
        <class-name>com.tangosol.io.pof.PofAnnotationSerializer</class-name>
        <init-params>
          <init-param>
            <param-type>int</param-type>
            <param-value>{type-id}</param-value>
          </init-param>
          <init-param>
            <param-type>class</param-type>
            <param-value>{class}</param-value>
          </init-param>
          <init-param>
            <param-type>boolean</param-type>
            <param-value>true</param-value>
          </init-param>
        </init-params>
      </serializer>
    </user-type>
MyPOFObject is using the POF annotations:
 
@Portable
public class MyPOFObject {

  @PortableProperty(FIELD1)
  private String field1;
  @PortableProperty(FIELD2)
  private String field2;
  ....
}
For the Extractor and Filter I have the following:
 
 NamedCache myCache = CacheFactory.getCache("myCache");
 ValueExtractor extractor = new PofExtractor(String.class, new SimplePofPath(MyPOFObject.FIELD1), PofExtractor.KEY);
 Filter equalsFilter = new EqualsFilter(extractor, "myData");
 Set<MyPOFObject> filteredKeys = myCache.keySet(equalsFilter);
 ...
Any help/ideas would be appreciated.

Thanks
  • 1. Re: SimplePofPath not serializable
    Jonathan.Knight Expert
    Currently Being Moderated
    Hi,

    From the stack trace it looks like it is trying to use normal Java serialization to serialize SimplePofPath - which does not implement java.io.Serializable. Are you sure you have POF enabled on your cluster?

    JK
  • 2. Re: SimplePofPath not serializable
    brianorwig Newbie
    Currently Being Moderated
    Yep, I was missing the following in the cache config file:
          <serializer>
            <instance>
              <class-name>com.tangosol.io.pof.ConfigurablePofContext</class-name>
              <init-params>
                <init-param>
                  <param-type>String</param-type>
                  <param-value>POFConfig.xml</param-value>
                </init-param>
              </init-params>
            </instance>
          </serializer>
    I also added the following JVM option:
      -Dtangosol.pof.enabled=true

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points