Skip to content

Non-shaded protobuf-java causing class mismatch issuesΒ #876

@onobc

Description

@onobc

The Pulsar client lib does not shade com.google.protobuf:protobuf-java and it is causing user's problems as described in original post by @nandorholozsnyak in #114 (comment)_

Workaround 1

Upgrade to Pulsar client 3.3.2 as he protobuf-java has been updated to 3.25.5.

If you plan on updating to the upcoming spring-pulsar 1.2.0-RC1 release (Spring Boot 3.4.0-RC1 / week of Oct 18) you will get this update automatically.
If you don't plan on updating Spring Pulsar then, you can override the version of Pulsar as described here.

This will bring the protobuf-java up to a recent version, solving the original author's issue, but will not fix future version mismatches.

Workaround 2

You can exclude protobuf-java from the current pulsar-client-all and provide the more recent dependency (example here.
Something like:

api ("org.apache.pulsar:pulsar-client-all") {
	exclude group: 'com.google.protobuf:protobuf-java'
}
api "com.google.protobuf:protobuf-java:3.25.5"

Improvement 1

We already exclude some other unwanted dependencies from the Pulsar lib (here.
We should likely exclude protobuf-java as well as we do include it explicitly already as optional dependency (here.

We will try to get the above improvement into the upcoming 1.2.0-RC1 release as well.

Improvement 2

We should also see about shading the protobuf-java lib in the Pulsar client libs to avoid this downstream required massaging.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions