Hi, Fuyao How did you define these classes? There is some requirements for POJO as flink docs[1] said: The class must be public.
It must have a public constructor without arguments (default constructor). All fields are either public or must be accessible through getter and setter functions. For a field called foo the getter and setter methods must be named getFoo() and setFoo(). The type of a field must be supported by a registered serializer. [1]https://nightlies.apache.org/flink/flink-docs-master/docs/dev/datastream/fault-tolerance/serialization/types_serialization/#pojos Best, Weihua > 2022年5月12日 上午3:03,Fuyao Li <fuyao...@oracle.com> 写道: > > Hi Community, > > I have a POJO that has nested recursively resolved structure. How should I > define the @TypeInfo annotation correctly to avoid stack overflow exception > when starting the application. > > Basically, > Class Metadata > Map<String, FieldDefinition> fields > > Class FieldDefinition > Metadata parentMetadata > > The Metadata class got resolved recursively and causing stack overflow. I had > to design this way since the metadata structure model looks like this. > > Is there any ways to fix this issue? Or I must treat this as a Generic type > and don’t add @TypeInfo annotation so it can fallback to Kryo. If it fall > back to Kryo and remove the > streamEnvironment.getConfig().disableGenericTypes(); statement, there won’t > be any problem during program startup. > > Thanks, > Fuyao