GitHub user ducquoc created a discussion: JSONSchema should works with generic (parameterized type) POJO/DTO.
#### Expected behavior JSONSchema should works with generic (parameterized type) POJO/DTO. No exception at runtime, or at least update documentation/errorMessage how to work-around/bypass the issue. #### Actual behavior Exception when running producer/consumer with `JSONSchema.of(clazz)` (or `Schema.JSON(clazz)` ) wiith generic/parameterized class: ``` Exception in thread "main" java.lang.NoSuchFieldError: KEY_VALUE at org.apache.pulsar.client.impl.schema.KeyValueSchema.<init>(KeyValueSchema.java:50) at org.apache.pulsar.client.api.Schema.<clinit>(Schema.java:128) ``` #### Steps to reproduce Create Producer or Consumer with client API, using `JSONSchema.of(clazz)` (or `Schema.JSON(clazz)` ) wiith generic/parameterized class. Compiled OK, but when running the client producer/consumer it throws exception. Example (https://github.com/ducquoc/pulsar/commit/a0649dc8): https://github.com/ducquoc/pulsar/blob/fix-client-schema_json-schema-generic-parameterized-type/pulsar-functions/java-examples/src/main/java/org/apache/pulsar/functions/api/examples/pojo/BrokerMessage.java ** Work-around: use ``` private Object payload; ``` and respective getter/setter instead of ``` private T payload; ``` #### System configuration **Pulsar version**: 2.2.0 (but seems to be also affected on latest master branch) GitHub link: https://github.com/apache/pulsar/discussions/18849 ---- This is an automatically sent email for dev@pulsar.apache.org. To unsubscribe, please send an email to: dev-unsubscr...@pulsar.apache.org