Gemfire 8.1 - 异常 - ServerOperationException - SerializationException - ClassNotFoundException

时间:2017-07-20 07:24:54

标签: serialization deserialization classnotfoundexception gemfire urlclassloader

我们正在使用Java 8 + Play 2应用程序进行编码。

我们正在从Gemfire 6迁移到Gemfire 8。

下面是我的gemfire client-cache.xml文件。

<?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>

有了这个配置,我就有很多与gemfire相关的东西工作,除了我在日志中收到以下异常。

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"

以下是我试图查看它是否有效解决此异常的问题

  1. 将client-cache.xml文件配置从CACHING_PROXY_HEAP_LRU更改为CACHING_PROXY甚至PROXY。它没有用,例外仍然存在
  2. 还尝试在client-cache.xml文件中添加以下内容,但它没有起作用。我是为所有地区做过的。
  3. &#13;
    &#13;
    <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>
    &#13;
    &#13;
    &#13;

    1. 除了这个例外,gemfire客户端6.6.2连接到gemfire服务器8.1.0后,一切似乎都运行正常

    2. 我已将gemfire客户端从6.6.2更新到8.1.0并在client-cache.xml文件中进行了更改,以便XML符合gemfire 8.1.0客户端。下面是我的Gemfire 8.1.0客户端的client-cache.xml文件。但错误仍然存​​在。

    3. &#13;
      &#13;
          <?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>
      &#13;
      &#13;
      &#13;

      有人可以在这方面提供帮助吗?

1 个答案:

答案 0 :(得分:0)

从例外情况来看,很明显服务器正在尝试反序列化models.article.Author的实例,但它无法在类路径中找到类定义。

您使用的是哪个data serialization mechanism?您是否尝试将包含类模型的jar添加到服务器的类路径?

干杯。