This is an automated email from the ASF dual-hosted git repository. chenhang pushed a commit to branch branch-2.8 in repository https://gitbox.apache.org/repos/asf/pulsar.git
commit 9789e3a42ae115f4e99a22f8b2ff361d091de475 Author: Guangning E <[email protected]> AuthorDate: Fri Aug 20 09:07:19 2021 +0800 [Functions]Support protobuf schema for pulsar function (#11709) ### Motivation Some users have encountered the following exception when using the protobuf schema, so add the relevant dependencies to the instance: ``` ERROR org.apache.pulsar.functions.instance.JavaInstanceRunnable - Sink open produced uncaught exception: java.lang.IllegalArgumentException: com.google.protobuf.GeneratedMessageV3 is not assignable from bold.proto.PersonOuterClass$Person at org.apache.pulsar.client.impl.schema.ProtobufSchema.of(ProtobufSchema.java:110) ~ ``` ### Modifications * Add the relevant dependencies to the instance ### Verifying this change - [x] Make sure that the change passes the CI checks. (cherry picked from commit f893c08ae5e356115cdaaa931982807174929f73) --- pulsar-functions/runtime-all/pom.xml | 17 +++++++++++++++++ .../pulsar/functions/instance/JavaInstanceDepsTest.java | 3 +++ 2 files changed, 20 insertions(+) diff --git a/pulsar-functions/runtime-all/pom.xml b/pulsar-functions/runtime-all/pom.xml index d50b0cb..ed5ff8c 100644 --- a/pulsar-functions/runtime-all/pom.xml +++ b/pulsar-functions/runtime-all/pom.xml @@ -79,6 +79,23 @@ <version>${jackson.databind.version}</version> </dependency> + <!--In order to support protobuf schema, this dependency needs to be added--> + <dependency> + <groupId>com.google.protobuf</groupId> + <artifactId>protobuf-java</artifactId> + <version>${protobuf3.version}</version> + </dependency> + <dependency> + <groupId>com.google.protobuf</groupId> + <artifactId>protobuf-java-util</artifactId> + <version>${protobuf3.version}</version> + </dependency> + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + <version>${gson.version}</version> + </dependency> + <!-- logging --> <dependency> diff --git a/pulsar-functions/runtime-all/src/test/java/org/apache/pulsar/functions/instance/JavaInstanceDepsTest.java b/pulsar-functions/runtime-all/src/test/java/org/apache/pulsar/functions/instance/JavaInstanceDepsTest.java index 859be4e..6f4ee68 100644 --- a/pulsar-functions/runtime-all/src/test/java/org/apache/pulsar/functions/instance/JavaInstanceDepsTest.java +++ b/pulsar-functions/runtime-all/src/test/java/org/apache/pulsar/functions/instance/JavaInstanceDepsTest.java @@ -72,6 +72,9 @@ public class JavaInstanceDepsTest { && !name.startsWith("org/apache/avro") && !name.startsWith("com/fasterxml/jackson") && !name.startsWith("org/apache/commons/compress") + && !name.startsWith("com/google") + && !name.startsWith("org/checkerframework") + && !name.startsWith("javax/annotation") && !name.startsWith("org/apache/logging/slf4j") && !name.startsWith("org/apache/logging/log4j")) { notAllowedClasses.add(name);
