Set Property with CustomClass got cannot be serialized error

I want to set a task property at the configuration phase. but when I set such property I got:
Execution failed for XXX_Decorated.

Unable to store input properties for XXX_Decorated. Property ‘glbcfg’ with value ‘XXX’ cannot be serialized.

the property is like: Property<CustomClass> glbcfg;
when I set the property with one CustomClass instance the error emitted.
But if I substitute CustomClass with String. the error is gone. The CustomClass is a POJO class.
How could I make the CustomClass suitable for Property<T> ?

Thanks in advance.

glbcfg should implement the interface Serializable