ducquoc opened a new issue #3115: JSONSchema should works with generic (parameterized type) POJO/DTO. URL: https://github.com/apache/pulsar/issues/3115 #### 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)
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
