pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] sijie opened a new issue #3734: NullPointerException at using BytesSchema.of()
Date Sat, 02 Mar 2019 13:09:30 GMT
sijie opened a new issue #3734: NullPointerException at using BytesSchema.of()
URL: https://github.com/apache/pulsar/issues/3734
 
 
   **Describe the bug**
   
   Exception occurred when using `BytesSchema.of()`
   
   ```
   Exception in thread "main" java.lang.ExceptionInInitializerError
   	at org.apache.pulsar.examples.simple.ProducerExample.main(ProducerExample.java:32)
   Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
   	at org.apache.pulsar.client.internal.ReflectionUtils.catchExceptions(ReflectionUtils.java:36)
   	at org.apache.pulsar.client.internal.DefaultImplementation.newKeyValueSchema(DefaultImplementation.java:158)
   	at org.apache.pulsar.client.api.Schema.<clinit>(Schema.java:123)
   	... 1 more
   Caused by: java.lang.reflect.InvocationTargetException
   	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
   	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
   	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
   	at org.apache.pulsar.client.internal.DefaultImplementation.lambda$newKeyValueSchema$16(DefaultImplementation.java:160)
   	at org.apache.pulsar.client.internal.ReflectionUtils.catchExceptions(ReflectionUtils.java:34)
   	... 3 more
   Caused by: java.lang.NullPointerException
   	at org.apache.pulsar.client.impl.schema.KeyValueSchema.<init>(KeyValueSchema.java:68)
   	... 9 more
   ```
   
   **To Reproduce**
   
   You can use following code to reproduce
   ```
   try (PulsarClient client = PulsarClient.builder()
                .serviceUrl(pulsarServiceUrl)
                .build()) {
               try (Producer<byte[]> producer = client.newProducer(BytesSchema.of())
                    .topic(topic)
                    .create()
               ) {
                   producer.send("hello world".getBytes(UTF_8));
               }
           } catch (PulsarClientException pce) {
               LOG.error("Failed to produce messages to " + pulsarServiceUrl, pce);
           }
   ```
   
   **Expected behavior**
   
   No exceptions should be thrown.
   
   **Additional context**
   
   This happens on 2.3.0. It is related to #3309 . After separating api module from client
module, we are using reflection to construct implementations. This approach caused some static
initialization are not executed correctly. 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message