Hi

I'm trying out Geode in client server mode with the following setup

Using gfsh I have created a region as
create region --name=/schedule --type=REPLICATE_PERSISTENT

and enabled pdx disk store on the server
configure pdx --disk-store=DEFAULT

The Spring Boot client is setup as
public class GeodeClientConfiguration {

    @Bean
    ClientCache cache() {
        return new ClientCacheFactory()
            .setPdxPersistent(true)
            .addPoolLocator("localhost", 10334)
            .setPdxDiskStore("foo")
            .setPdxReadSerialized(true)
            .setPdxSerializer(new ReflectionBasedAutoSerializer(false, 
"foo.ScheduleRequest", "bar.EpgProgram"))
            .create();
    }

    @Bean
    Region<ScheduleRequest, List<EpgProgram>> testRegion(final ClientCache 
cache) {
        return cache.<ScheduleRequest, List<EpgProgram>> getRegion("schedule");
    }

I has to include a cache.xml as
<?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>
    <pdx disk-store-name="foo" read-serialized="true">
        <pdx-serializer>
            
<class-name>org.apache.geode.pdx.ReflectionBasedAutoSerializer</class-name>
            <parameter name="classes">
                <string>xxx....</string>
            </parameter>
        </pdx-serializer>

    </pdx>
    <region name="schedule"  refid="CACHING_PROXY">
        <region-attributes pool-name="serverPool"
                scope="global" />
    </region>
</client-cache>

I guess this shouldn't he necessary, but I didn't currently manage to get the 
java config work without it ??

Logs from boot startup shows that it is running in client mode
[info 2016/12/15 09:31:49.278 CET <restartedMain> tid=0x14] Running in client 
mode


[info 2016/12/15 09:31:49.510 CET <restartedMain> tid=0x14] Pool serverPool 
started with multiuser-authentication=false

[info 2016/12/15 09:31:49.518 CET <poolTimer-serverPool-2> tid=0x28] 
AutoConnectionSource discovered new locators [host/10.65.95.154:10334]

[info 2016/12/15 09:31:49.519 CET <poolTimer-serverPool-3> tid=0x29] Updating 
membership port.  Port changed from 0 to 51.808.  ID is now 
A78029(1164:loner):0:00de9b01

When using the region in code as

        ScheduleRequest scheduleRequest = new ScheduleRequest(channel, 
broadcastDate);
        List<EpgProgram> list = schedule.get(scheduleRequest);
I get an Pdx Serialization exception

2016-12-15 09:32:50.465  INFO 1164 --- [nio-8080-exec-1] 
o.s.web.servlet.DispatcherServlet        : FrameworkServlet 
'dispatcherServlet': initialization completed in 24 ms
[info 2016/12/15 09:32:54.564 CET <http-nio-8080-exec-1> tid=0x3c] Auto 
serializer generating type for class foo.ScheduleRequest for fields:
    channel: private java.lang.String foo.ScheduleRequest.channel
    broadcastDate: private java.time.LocalDate foo.ScheduleRequest.broadcastDate


[info 2016/12/15 09:32:54.572 CET <http-nio-8080-exec-1> tid=0x3c] Defining: 
PdxType[
    dsid=0, typenum=2, name=foo.ScheduleRequest, fields=[
        channel:String:0:idx0(relativeOffset)=0:idx1(vlfOffsetIndex)=-1
        broadcastDate:Object:1:1:idx0(relativeOffset)=0:idx1(vlfOffsetIndex)=1]]

2016-12-15 09:32:54.607 ERROR 1164 --- [nio-8080-exec-1] 
o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet 
[dispatcherServlet] in context with path [] threw exception [Request processing 
failed; nested exception is 
org.apache.geode.cache.client.ServerOperationException: remote server on 
A78029(1164:loner):51808:00de9b01: 
org.apache.geode.pdx.PdxSerializationException: Could not create an instance of 
a class foo.ScheduleRequest] with root cause

java.lang.ClassNotFoundException: foo.ScheduleRequest
                             at 
org.apache.geode.internal.ClassPathLoader.forName(ClassPathLoader.java:426) 
~[geode-core-1.0.0-incubating.jar:na]
                             at 
org.apache.geode.internal.InternalDataSerializer.getCachedClass(InternalDataSerializer.java:4006)
 ~[geode-core-1.0.0-incubating.jar:na]
                             at 
org.apache.geode.pdx.internal.PdxType.getPdxClass(PdxType.java:236) 
~[geode-core-1.0.0-incubating.jar:na]
                             at 
org.apache.geode.pdx.internal.PdxReaderImpl.basicGetObject(PdxReaderImpl.java:686)
 ~[geode-core-1.0.0-incubating.jar:na]
                             at 
org.apache.geode.pdx.internal.PdxReaderImpl.getObject(PdxReaderImpl.java:682) 
~[geode-core-1.0.0-incubating.jar:na]
                             at 
org.apache.geode.internal.InternalDataSerializer.readPdxSerializable(InternalDataSerializer.java:3210)
 ~[geode-core-1.0.0-incubating.jar:na]
                             at 
org.apache.geode.internal.InternalDataSerializer.basicReadObject(InternalDataSerializer.java:3008)
 ~[geode-core-1.0.0-incubating.jar:na]
                             at 
org.apache.geode.DataSerializer.readObject(DataSerializer.java:3281) 
~[geode-core-1.0.0-incubating.jar:na]
                             at 
org.apache.geode.internal.util.BlobHelper.deserializeBlob(BlobHelper.java:94) 
~[geode-core-1.0.0-incubating.jar:na]
                             at 
org.apache.geode.internal.cache.tier.sockets.CacheServerHelper.deserialize(CacheServerHelper.java:82)
 ~[geode-core-1.0.0-incubating.jar:na]
                             at 
org.apache.geode.internal.cache.tier.sockets.Part.getObject(Part.java:273) 
~[geode-core-1.0.0-incubating.jar:na]
                             at 
org.apache.geode.internal.cache.tier.sockets.Part.getObject(Part.java:282) 
~[geode-core-1.0.0-incubating.jar:na]
                             at 
org.apache.geode.internal.cache.tier.sockets.Part.getStringOrObject(Part.java:287)
 ~[geode-core-1.0.0-incubating.jar:na]
                             at 
org.apache.geode.internal.cache.tier.sockets.command.Get70.cmdExecute(Get70.java:95)
 ~[geode-core-1.0.0-incubating.jar:na]
                             at 
org.apache.geode.internal.cache.tier.sockets.BaseCommand.execute(BaseCommand.java:147)
 ~[geode-core-1.0.0-incubating.jar:na]
                             at 
org.apache.geode.internal.cache.tier.sockets.ServerConnection.doNormalMsg(ServerConnection.java:783)
 ~[geode-core-1.0.0-incubating.jar:na]
                             at 
org.apache.geode.internal.cache.tier.sockets.ServerConnection.doOneMessage(ServerConnection.java:913)
 ~[geode-core-1.0.0-incubating.jar:na]
                             at 
org.apache.geode.internal.cache.tier.sockets.ServerConnection.run(ServerConnection.java:1180)
 ~[geode-core-1.0.0-incubating.jar:na]
                             at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
~[na:1.8.0_73]
                             at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
~[na:1.8.0_73]
                             at 
org.apache.geode.internal.cache.tier.sockets.AcceptorImpl$1$1.run(AcceptorImpl.java:546)
 ~[geode-core-1.0.0-incubating.jar:na]
                             at java.lang.Thread.run(Thread.java:745) 
[na:1.8.0_73]

I guess the geode server should have the pdx serializing pushed ?

Best regards
Preben

Reply via email to