Skip to content

PdxSerializer is not initialized properly when both OnRegion and OnServer/OnServers Functions are defined [DATAGEODE-294] #339

Open
@spring-projects-issues

Description

@spring-projects-issues

boglesby opened DATAGEODE-294 and commented

This is with SBDG 1.2.1.RELEASE and also 1.2.2.RELEASE.

I have a SB client with a Repository and an OnRegion function. Doing puts with a lombok domain object and executing the function works fine. The object is PDX-serialized using the MappingPdxSerializer.

If I add an OnServers function, both functions work, but the puts no longer work. I see this IllegalStateException:

java.lang.IllegalStateException: Failed to execute ApplicationRunner
        at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:778) ~[spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
        at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:765) ~[spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:322) ~[spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
        at io.pivotal.test.client.Client.main(Client.java:35) [classes/:na]
Caused by: java.io.NotSerializableException: io.pivotal.test.client.domain.Trade
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184) ~[na:1.8.0_121]
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348) ~[na:1.8.0_121]
        at org.apache.geode.internal.InternalDataSerializer.writeSerializableObject(InternalDataSerializer.java:2385) ~[geode-core-1.9.2.jar:na]
        at org.apache.geode.internal.InternalDataSerializer.basicWriteObject(InternalDataSerializer.java:2259) ~[geode-core-1.9.2.jar:na]
        at org.apache.geode.DataSerializer.writeObject(DataSerializer.java:2953) ~[geode-core-1.9.2.jar:na]
        at org.apache.geode.internal.util.BlobHelper.serializeTo(BlobHelper.java:66) ~[geode-core-1.9.2.jar:na]
        at org.apache.geode.internal.cache.tier.sockets.Message.serializeAndAddPart(Message.java:400) ~[geode-core-1.9.2.jar:na]

If I add some debugging to TypeRegistry.setPdxSerializer method, I see this in the successful case:

2019-12-16 09:15:09.154  WARN 73584 — [main] o.a.geode.pdx.internal.TypeRegistry: TypeRegistry.setPdxSerializer serializer=org.springframework.data.gemfire.mapping.MappingPdxSerializer@6cff61fc

And this in the failed case:

2019-12-16 09:13:02.397  WARN 73306 — [main] o.a.geode.pdx.internal.TypeRegistry: TypeRegistry.setPdxSerializer serializer=null

Also, if I remove the original OnRegion function and keep just the OnServers function, puts work fine.

My client has these annotations:

@SpringBootApplication(exclude = ContinuousQueryAutoConfiguration.class)
@EnableEntityDefinedRegions(basePackageClasses = Trade.class)

I also tried adding my own custom PdxSerializer like:

@EnablePdx(serializerBeanName = "myCustomMappingPdxSerializer")
@Bean
MappingPdxSerializer myCustomMappingPdxSerializer() {
  return MappingPdxSerializer.newMappingPdxSerializer();
}

In that case, the myCustomMappingPdxSerializer method was called, but only after the PdxSerializer had already been set to null in the TypeRegistry, and it didn't cause it to be reset.

I attached the full stacks for both cases


Attachments:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions