Has anyone gotten Protobuf to work with Schema Reg...
# troubleshooting
j
Has anyone gotten Protobuf to work with Schema Registry? I'm struggling to get past the following error:
Copy code
Cannot construct instance of `org.apache.druid.data.input.protobuf.SchemaRegistryBasedProtobufBytesDecoder`, problem: io/confluent/kafka/schemaregistry/protobuf/ProtobufSchemaProvider
The instructions here seem to be wrong: https://druid.apache.org/docs/latest/development/extensions-core/protobuf/#when-using-schema-registry (there is no extension-core folder and creating it didn't fix the issue) I also tried placing the jars to
extensions/protobuf-extensions
and
extensions/druid-protobuf-extensions
but still no luck...
It looks like it is loaded...
Copy code
2025-10-07T20:23:34,367 INFO [main] org.apache.druid.guice.ExtensionsLoader - Loading extension [druid-protobuf-extensions], jars: druid-protobuf-extensions-33.0.0.jar, wire-schema-3.2.2.jar, kotlin-stdlib-1.4.0.jar, kafka-protobuf-provider-6.0.1.jar. Druid extension dependencies [[]]
b
I guess you also added druid-protobuf-extensions in your loadList (which is why it's showing that "Loading" message)?
I don't see what else needs to be done, but in case it helps, this blog post goes through the steps, too.
j
Sadly that blog post doesn't provide any additional information 😢
So I checked out the source code and I realized that
io.confluent.kafka.schemaregistry.protobuf.ProtobufSchemaProvider
(from
kafka-protobuf-provider
jar) imports and extends
io.confluent.kafka.schemaregistry.AbstractSchemaProvider
but that class isn't included in the jar...
BTW the documentation is woefully out of date (Dec 2020)
b
Were you able to grab that jar, and put it in the directory, and if so, did that work?
j
I pulled down
kafka-schema-registry-client-6.2.12.jar
into
druid-protobuf-extensions
folder (and restarted) but no luck 😢
The last thing I've tried is loading all dependencies using the cli
Copy code
java -classpath "lib/*" org.apache.druid.cli.Main tools pull-deps -r "https://packages.confluent.io/maven/" -c io.confluent:kafka-protobuf-provider:6.2.12
Sadly, this also did not do the trick. 😢 It seems the
druid-protobuf-extensions
is broken for Schema Registry.
My gut right now tells me there's some sort of dependency conflict within the transitive dependencies of the
kafka-protobuf-provider
causing this.
Dependency Tree:
Copy code
[INFO] \- io.confluent:kafka-protobuf-provider:jar:6.2.12:compile
[INFO]    +- com.squareup.wire:wire-schema:jar:3.6.0:compile
[INFO]    |  +- com.google.guava:guava:jar:20.0:compile
[INFO]    |  +- com.squareup.wire:wire-runtime:jar:3.6.0:compile
[INFO]    |  |  \- org.jetbrains.kotlin:kotlin-stdlib-jdk8:jar:1.4.10:compile
[INFO]    |  |     \- org.jetbrains.kotlin:kotlin-stdlib-jdk7:jar:1.4.10:compile
[INFO]    |  +- org.jetbrains.kotlin:kotlin-stdlib-common:jar:1.4.10:compile
[INFO]    |  \- com.squareup.okio:okio:jar:2.8.0:compile
[INFO]    +- org.jetbrains.kotlin:kotlin-stdlib:jar:1.6.0:compile
[INFO]    |  \- org.jetbrains:annotations:jar:13.0:compile
[INFO]    +- com.google.protobuf:protobuf-java:jar:3.19.6:compile
[INFO]    +- com.google.protobuf:protobuf-java-util:jar:3.19.6:compile
[INFO]    |  +- com.google.errorprone:error_prone_annotations:jar:2.5.1:compile
[INFO]    |  +- com.google.j2objc:j2objc-annotations:jar:1.3:compile
[INFO]    |  +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO]    |  \- com.google.code.gson:gson:jar:2.8.6:compile
[INFO]    +- com.google.api.grpc:proto-google-common-protos:jar:2.22.1:compile
[INFO]    +- io.confluent:kafka-schema-registry-client:jar:6.2.12:compile
[INFO]    |  +- org.yaml:snakeyaml:jar:2.0:compile
[INFO]    |  +- org.apache.kafka:kafka-clients:jar:6.2.12-ccs:compile
[INFO]    |  |  +- com.github.luben:zstd-jni:jar:1.4.9-1:compile
[INFO]    |  |  +- org.lz4:lz4-java:jar:1.7.1:compile
[INFO]    |  |  \- org.xerial.snappy:snappy-java:jar:1.1.10.1:compile
[INFO]    |  +- org.apache.avro:avro:jar:1.10.1:compile
[INFO]    |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.11.3:compile
[INFO]    |  +- org.apache.commons:commons-compress:jar:1.21:compile
[INFO]    |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.14.2:compile
[INFO]    |  |  \- com.fasterxml.jackson.core:jackson-annotations:jar:2.14.2:compile
[INFO]    |  +- io.swagger:swagger-annotations:jar:1.6.2:compile
[INFO]    |  \- io.swagger:swagger-core:jar:1.6.2:compile
[INFO]    |     +- org.apache.commons:commons-lang3:jar:3.2.1:compile
[INFO]    |     +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.11.1:compile
[INFO]    |     \- io.swagger:swagger-models:jar:1.6.2:compile
[INFO]    +- io.confluent:kafka-protobuf-types:jar:6.2.12:compile
[INFO]    \- io.confluent:common-utils:jar:6.2.12:compile
[INFO]       \- org.slf4j:slf4j-api:jar:1.7.36:compile
I wrote a program Test.java which simply calls
new ProtobufSchemaProvider()
Then I use the following command to download dependencies:
Copy code
java -classpath "/druid/lib/*" org.apache.druid.cli.Main tools pull-deps -r "https://packages.confluent.io/maven/" -c io.confluent:kafka-protobuf-provider:6.2.12
Then I run my test via:
Copy code
java Test -cp "extensions/kafka-protobuf-provider/*"
And get output:
Copy code
Exception in thread "main" java.lang.NoClassDefFoundError: io/confluent/kafka/schemaregistry/protobuf/ProtobufSchemaProvider
	at Test.main(Test.java:8)
Caused by: java.lang.ClassNotFoundException: io.confluent.kafka.schemaregistry.protobuf.ProtobufSchemaProvider
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
	... 1 more
So I think the version of
kafka-protobuf-provider
that
druid-protobuf-extensions-33.0.0.jar
uses has dependency conflicts. Since the extension doesn't include a working
kafka-protobuf-provider
jar without conflicts there's simply no way to use the Schema Registry with protobuf in Druid today. Can anyone help with this dependency hell?
Okay, I actually got his working now by using the old jars from 2020 and also enabling the
druid-avro-extensions
It would be great if there was guidance on using a newer version of the dependency or just include the dependencies (i.e. like the avro extension does). But I shall consider this issue closed foe the time being, at least until we upgrade Druid and run into this dependency nightmare again.
b
you needed to do both? And does "old jars" mean older versions of the 3 that are documented to grab?
j
By old jars I mean the ones documented here and not the ones actually depended on by the druid-protobuf-extensions (found via pom.xml).
b
ah, I see, thank you. interesting to me that you also had to enable druid-avro-extensions...
j
I enabled
druid-avro-extensions
because I noticed that it includes
kafka-schema-registry-client-6.2.12.jar
It could be a red herring though. It includes a lot of other dependencies as well
I hope in the future that
druid-protobuf-extensions
includes its dependencies. Else I could run into issues at the next Druid upgrade.
Also note that the documentation says to "Copy or symlink those files inside the folder
extensions-core/protobuf-extensions
under the distribution root directory." However, the correct directory is:
extensions/druid-protobuf-extensions