You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/04/24 06:25:32 UTC

[GitHub] [pulsar] lhotari commented on issue #6484: pulsar-client-admin-2.5.0.jar contains an unshaded protobuf dependency

lhotari commented on issue #6484:
URL: https://github.com/apache/pulsar/issues/6484#issuecomment-618827497


   Shading protobuf might not solve all issues. The generated protobuf classes seem to have dependencies to specific protobuf version like already mentioned in https://github.com/apache/pulsar/issues/6484#issuecomment-600413743. Here's an example of a stack trace when using Pulsar client 2.5.1 and a Protobuf class compiled with Protobuf protoc version 3.11.4 :
   
   ```
   java.lang.NoSuchMethodError: 'com.google.protobuf.Descriptors$FileDescriptor com.google.protobuf.Descriptors$FileDescriptor.internalBuildGeneratedFileFrom(java.lang.String[], com.google.protobuf.Descriptors$FileDescriptor[])'
       at my.code.proto.SomeOuterClass.<clinit>(SomeOuterClass.java:44)
       at my.code.proto.SomeApi.<clinit>(SomeApi.java:75)
       at my.code.proto.Something.getDescriptor(Something.java:112)
       ... 139 more
   ```
   
   <details>
   <summary>Full stacktrace</summary>
   <pre>
   java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
       at org.apache.pulsar.shade.org.apache.avro.protobuf.ProtobufData.getSchema(ProtobufData.java:189)
       at org.apache.pulsar.client.impl.schema.ProtobufSchema.createProtobufAvroSchema(ProtobufSchema.java:64)
       at org.apache.pulsar.client.impl.schema.ProtobufSchema.of(ProtobufSchema.java:120)
       at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
       at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.base/java.lang.reflect.Method.invoke(Method.java:566)
       at org.apache.pulsar.client.internal.DefaultImplementation.lambda$newProtobufSchema$25(DefaultImplementation.java:235)
       at org.apache.pulsar.client.internal.ReflectionUtils.catchExceptions(ReflectionUtils.java:35)
       at org.apache.pulsar.client.internal.DefaultImplementation.newProtobufSchema(DefaultImplementation.java:232)
       at org.apache.pulsar.client.api.Schema.PROTOBUF(Schema.java:220)
       ...
       Caused by:
       java.lang.reflect.InvocationTargetException
           at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
           at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.base/java.lang.reflect.Method.invoke(Method.java:566)
           at org.apache.pulsar.shade.org.apache.avro.protobuf.ProtobufData.getSchema(ProtobufData.java:183)
           ... 134 more
   
           Caused by:
           java.lang.NoSuchMethodError: 'com.google.protobuf.Descriptors$FileDescriptor com.google.protobuf.Descriptors$FileDescriptor.internalBuildGeneratedFileFrom(java.lang.String[], com.google.protobuf.Descriptors$FileDescriptor[])'
               at my.code.proto.SomeOuterClass.<clinit>(SomeOuterClass.java:44)
               at my.code.proto.SomeApi.<clinit>(SomeApi.java:75)
               at my.code.proto.Something.getDescriptor(Something.java:112)
               ... 139 more
   </pre>
   </details>
   
   It seems that Apache Avro depends on a specific Protobuf version and it's not possible to upgrade it since it's shaded. Is there a plain "unshaded" Pulsar client available? 
   It seems that Avro 1.9.1 depends on Protobuf 3.6.1 . That was released 31-Jul-2018 . The newest Protobuf version is currently 3.11.4 . 
   Is there a way to use a newer Protobuf version with Pulsar?


----------------------------------------------------------------
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