0

We are coding in Java 8 + Play 2 application.

We are in process of migrating from Gemfire 6 to Gemfire 8.

Below is my gemfire client-cache.xml file.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE client-cache PUBLIC
  "-//GemStone Systems, Inc.//GemFire Declarative Caching 6.6//EN"
  "http://www.gemstone.com/dtd/cache6_6.dtd">

<client-cache>
  <pool name="gemfire_qa_instance" subscription-enabled="true">
    <locator host="somehost1" port="42101" />
    <locator host="somehost2" port="42101" />
    <locator host="somehost3" port="42101" />
    <locator host="somehost4" port="42101" />
  </pool>

  <region name="customer" refid="CACHING_PROXY_HEAP_LRU">
    <region-attributes>
      <cache-listener>
        <class-name>ser.cac.CustomerListener</class-name>
      </cache-listener>
    </region-attributes>
  </region>

  <region name="s2o_customer" refid="CACHING_PROXY_HEAP_LRU">
    <region-attributes>
      <cache-listener>
        <class-name>ser.cac.CustomerListener</class-name>
      </cache-listener>
    </region-attributes>
  </region>

  <region name="ten_minute_ttl" refid="CACHING_PROXY_HEAP_LRU" />

  <region name="five_minute_ttl" refid="CACHING_PROXY_HEAP_LRU" />

  <region name="six_hour_idle" refid="CACHING_PROXY_HEAP_LRU"/>

  <region name="ten_minute_idle" refid="CACHING_PROXY_HEAP_LRU" />

  <resource-manager critical-heap-percentage="99" eviction-heap-percentage="90" />

</client-cache>

With this configuration in place I have number of gemfire related things working except that I receive below exception in the logs.

2017-07-17 06:15:03,718 WARN application - status="0" action="CACHE_PUT_ALL" event_description="failure on cache 'region 'ten_minute_ttl.split_b37_PID0000_document_author'' for key '[757227, CMS_757227]' with message:  com.gemstone.gemfire.SerializationException: A ClassNotFoundException was thrown while trying to deserialize cached value." appId="MOBSVC_P2" request_id="5d313d75-e4ec-406b-a842-0a3ff5d9f1a4" version="1.0" locale="fr-CA" productId="JOB" level="WARN" event_status="success" event_severity="info" exception=com.gemstone.gemfire.cache.client.ServerOperationException: com.gemstone.gemfire.SerializationException: A ClassNotFoundException was thrown while trying to deserialize cached value.
     at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.handleException(OpExecutorImpl.java:560)
     at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.handleException(OpExecutorImpl.java:657)
     at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.handleException(OpExecutorImpl.java:495)
     at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.executeOnServer(OpExecutorImpl.java:336)
     at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.executeOn(OpExecutorImpl.java:303)
     at com.gemstone.gemfire.cache.client.internal.PoolImpl.executeOn(PoolImpl.java:659)
     at com.gemstone.gemfire.cache.client.internal.SingleHopOperationCallable.call(SingleHopOperationCallable.java:45)
     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
     at java.lang.Thread.run(Thread.java:745)
 Caused by: com.gemstone.gemfire.SerializationException: A ClassNotFoundException was thrown while trying to deserialize cached value.
     at com.gemstone.gemfire.internal.cache.EntryEventImpl.deserialize(EntryEventImpl.java:1561)
     at com.gemstone.gemfire.internal.cache.EntryEventImpl.deserialize(EntryEventImpl.java:1546)
     at com.gemstone.gemfire.internal.cache.VMCachedDeserializable.getDeserializedForReading(VMCachedDeserializable.java:153)
     at com.gemstone.gemfire.cache.operations.PutAllOperationContext$UpdateOnlyMap.exportValue(PutAllOperationContext.java:171)
     at com.gemstone.gemfire.cache.operations.PutAllOperationContext$UpdateOnlyMap.access$300(PutAllOperationContext.java:144)
     at com.gemstone.gemfire.cache.operations.PutAllOperationContext$UpdateOnlyMap$ExportableEntry.getValue(PutAllOperationContext.java:256)
     at com.gemstone.gemfire.internal.cache.LocalRegion.verifyPutAllMap(LocalRegion.java:9695)
     at com.gemstone.gemfire.internal.cache.LocalRegion.basicPutAll(LocalRegion.java:9842)
     at com.gemstone.gemfire.internal.cache.LocalRegion.basicBridgePutAll(LocalRegion.java:9742)
     at com.gemstone.gemfire.internal.cache.tier.sockets.command.PutAll.cmdExecute(PutAll.java:206)
     at com.gemstone.gemfire.internal.cache.tier.sockets.BaseCommand.execute(BaseCommand.java:182)
     at com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection.doNormalMsg(ServerConnection.java:789)
     at com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection.doOneMessage(ServerConnection.java:920)
     at com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection.run(ServerConnection.java:1128)
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
     at com.gemstone.gemfire.internal.cache.tier.sockets.AcceptorImpl$1$1.run(AcceptorImpl.java:577)
     ... 1 more
 Caused by: java.lang.ClassNotFoundException: models.article.Author
     at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
     at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
     at java.security.AccessController.doPrivileged(Native Method)
     at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
     at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
     at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
     at java.lang.Class.forName0(Native Method)
     at java.lang.Class.forName(Class.java:344)
     at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:626)
     at com.gemstone.gemfire.internal.InternalDataSerializer$DSObjectInputStream.resolveClass(InternalDataSerializer.java:3563)
     at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1613)
     at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1518)
     at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1774)
     at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
     at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
     at com.gemstone.gemfire.internal.InternalDataSerializer.basicReadObject(InternalDataSerializer.java:2966)
     at com.gemstone.gemfire.DataSerializer.readObject(DataSerializer.java:3210)
     at com.gemstone.gemfire.internal.util.BlobHelper.deserializeBlob(BlobHelper.java:110)
     at com.gemstone.gemfire.internal.cache.EntryEventImpl.deserialize(EntryEventImpl.java:1554)
     ... 17 more
 2017-07-17 06:15:03,729 INFO application - status="0" event_description="produced 2 of the remaining 1 Author(s)" appId="MOBSVC_P2" request_id="5d313d75-e4ec-406b-a842-0a3ff5d9f1a4" version="1.0" locale="fr-CA" productId="JOB" level="DEFAULT" event_status="success" event_severity="info"

Now below are the things I tried to see if it works to resolve this exception

  1. Changed the client-cache.xml file configuration from CACHING_PROXY_HEAP_LRU to CACHING_PROXY and even PROXY. It does not worked, exception is still present
  2. Also tried adding below thing in the client-cache.xml file but it did not worked as well. I did it for all the regions.

<region name="five_minute_ttl" refid="CACHING_PROXY_HEAP_LRU">
        <region-attributes pool-name="gemfire_qa_instance">
            <eviction-attributes>
                <lru-heap-percentage action="local-destroy" />
            </eviction-attributes>
        </region-attributes>
    </region>
  1. Other than this exception, everything seems to be working fine with the gemfire client 6.6.2 connecting to gemfire server 8.1.0

  2. I have updated the gemfire client from 6.6.2 to 8.1.0 and made the changes in the client-cache.xml file so that the XML is compliant to the gemfire 8.1.0 client. Below is my client-cache.xml file for Gemfire 8.1.0 client. But the error is still present.

    <?xml version="1.0"?>
    <client-cache xmlns="http://schema.pivotal.io/gemfire/cache" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schema.pivotal.io/gemfire/cache http://schema.pivotal.io/gemfire/cache/cache-8.1.xsd" version="8.1">
        <pool name="gemfire_qa_instance" subscription-enabled="true">
            <locator host="somehost1" port="42101" />
            <locator host="somehost2" port="42101" />
            <locator host="somehost3" port="42101" />
            <locator host="somehost4" port="42101" />
        </pool>
        <region name="customer" refid="CACHING_PROXY_HEAP_LRU">
            <region-attributes>
                <cache-listener>
                    <class-name>ser.cac.CustomerListener</class-name>
                </cache-listener>
            </region-attributes>
        </region>
        <region name="s2o_customer" refid="CACHING_PROXY_HEAP_LRU">
            <region-attributes>
                <cache-listener>
                    <class-name>ser.cac.CustomerListener</class-name>
                </cache-listener>
            </region-attributes>
        </region>
        <region name="ten_minute_ttl" refid="CACHING_PROXY_HEAP_LRU" />
        <region name="five_minute_ttl" refid="CACHING_PROXY_HEAP_LRU" />
        <region name="six_hour_idle" refid="CACHING_PROXY_HEAP_LRU" />
        <region name="ten_minute_idle" refid="CACHING_PROXY_HEAP_LRU" />
        <resource-manager critical-heap-percentage="99" eviction-heap-percentage="90" />
    </client-cache>

Can someone help in this regard?

1 Answers1

0

From the exception, it's clear that the server is trying to deserialize an instance of models.article.Author, but it can't find the class definition within the classpath.

Which data serialization mechanism are you using?, have you tried adding the jar containing the class model to the server's classpath?.

Cheers.

Juan Ramos
  • 1,421
  • 1
  • 8
  • 13
  • The class models.article.Author is a part of the deployed artifact. Its not referenced from the external jar file. Further it is also important to note that when I connect to Gemfire 6 instances using the same artifact it works just fine. – user3616964 Jul 20 '17 at 08:08
  • Re: data serialization mechanism, I don't know if there is any specific data serialization mechanism that I am using. All the classes are subtypes of java's Serializable interface thus I assume that gemfire is extending the same serialization strategy. I have not defined any serialization/de-serialization strategy in the client-cache.xml file as well. Thus may be the default serialization strategy might be getting used. I will refer link you provided. – user3616964 Jul 20 '17 at 08:12