eolivelli opened a new pull request #10827:
URL: https://github.com/apache/pulsar/pull/10827


   ### Motivation
   
   With recent changes in Pulsar IO we are bundling the Pulsar Client 
Implementation in the classpath of the Functions/Pulsar IO connectors.
   Sometimes it happens that calls to DefaultImplementation fail, like this 
call to `SchemaBuilder.record()`:
   
   
   ```
   
   Caused by: java.lang.RuntimeException: java.lang.RuntimeException: 
java.lang.ClassNotFoundException: 
org.apache.pulsar.client.impl.schema.RecordSchemaBuilderImpl
        at 
org.apache.pulsar.client.internal.ReflectionUtils.catchExceptions(ReflectionUtils.java:46)
 ~[java-instance.jar:?]
        at 
org.apache.pulsar.client.internal.DefaultImplementation.newRecordSchemaBuilder(DefaultImplementation.java:356)
 ~[java-instance.jar:?]
        at 
org.apache.pulsar.client.api.schema.SchemaBuilder.record(SchemaBuilder.java:39) 
~[java-instance.jar:?]
        at 
com.datastax.oss.pulsar.source.converters.AbstractGenericConverter.<init>(AbstractGenericConverter.java:58)
 ~[?:?]
        at 
com.datastax.oss.pulsar.source.converters.AvroConverter.<init>(AvroConverter.java:30)
 ~[?:?]
        ... 10 more
   Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: 
org.apache.pulsar.client.impl.schema.RecordSchemaBuilderImpl
        at 
org.apache.pulsar.client.internal.ReflectionUtils.newClassInstance(ReflectionUtils.java:63)
 ~[java-instance.jar:?]
        at 
org.apache.pulsar.client.internal.ReflectionUtils.getConstructor(ReflectionUtils.java:69)
 ~[java-instance.jar:?]
   
   ```
   
   ### Modifications
   
   Using Class.forName allows Java classes loaded in the Functions Runtime to 
fully use the Implementation classes loaded from the Pulsar API using 
DefaultImplementation
   
   ### Verifying this change
   
   This change is a trivial rework / code cleanup without any test coverage.
   


-- 
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:
us...@infra.apache.org


Reply via email to