使用 SB 创建 Geode 客户端缓存时,我在远程 Geode 实例上遇到 PDX 序列化问题 ->
@Configuration
public class GeodeClientConfiguration {
@Bean
ClientCache cache() {
return new ClientCacheFactory()
.setPdxPersistent(true)
.setPdxDiskStore("foo")
.setPdxReadSerialized(true)
.setPdxSerializer(new ReflectionBasedAutoSerializer(false, "foo.EpgProgram"))
.create();
}
@Bean
Region<String, List<EpgProgram>> testRegion(final ClientCache cache) {
return cache.<String, List<EpgProgram>> getRegion("schedule");
}
cache.xml 看起来像 ->
<?xml version="1.0" encoding="UTF-8"?>
<client-cache
xmlns="http://geode.apache.org/schema/cache"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://geode.apache.org/schema/cache
http://geode.apache.org/schema/cache/cache-1.0.xsd"
version="1.0">
<pool name="serverPool">
<locator host="localhost" port="10334"/>
</pool>
<region name="schedule" refid="CACHING_PROXY">
<region-attributes pool-name="serverPool"
scope="global" />
</region>
在 Gfsh 我创建了一个区域为
create region --name=/schedule --type=REPLICATE_PERSISTENT
在方法中测试期间将 EpgProgram 列表添加到区域时
public List<EpgProgram> getScheduleFromWhatson(String channel, LocalDate broadcastDate, Boolean expand) throws RestClientException, URISyntaxException {
List<EpgProgram> programs = transform(whatsOnServiceInternal.getScheduleFromWhatson(channel, broadcastDate), expand);
schedule.put(channel, programs);
return programs;
}
pdx 实例似乎是使用从信息跟踪中看到的反射生成的->
[info 2016/12/09 11:32:33.361 CET <http-nio-8080-exec-1> tid=0xc8] Auto serializer generating type for class dk.dr.epg.core.EpgProgram for fields:
printable: private boolean dk.dr.epg.core.EpgProgram.printable
live: private boolean dk.dr.epg.core.EpgProgram.live
rerun: private boolean dk.dr.epg.core.EpgProgram.rerun
但就在那之后我得到了一个例外->
org.apache.geode.pdx.PdxInitializationException: The PDX metadata must be persistent in a member that has persistent data. See CacheFactory.setPdxPersistent.
错过了我必须设置 Pdx persistense 的任何其他地方?
Geode 版本:1.0.0-孵化。