Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
onobc opened this issue Oct 8, 2024 · 5 comments · Fixed by #896
Closed

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

onobc opened this issue Oct 8, 2024 · 5 comments · Fixed by #896
Labels
type: dependency-upgrade A dependency upgrade type: improvement An improvement of implementation of existing feature
Milestone

Comments

@onobc
Copy link
Collaborator

onobc commented Oct 8, 2024

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.

@onobc onobc added this to the 1.2.0-RC1 milestone Oct 8, 2024
@onobc onobc added the type: dependency-upgrade A dependency upgrade label Oct 8, 2024
@nandorholozsnyak
Copy link

Hello @onobc
Thank you for the issue here too, just a quick question for clarity: The Pulsar client lib does not shade com.google.protobuf:protobuf-java and it is causing user's problems as described in original post
Indeed the pulsar-client lib is not shading it, but is it the real issue? If it would it may break others as well isnt it?

@onobc
Copy link
Collaborator Author

onobc commented Oct 10, 2024

Hi @nandorholozsnyak

pulsar-client lib is not shading it, but is it the real issue? If it would it may break others as well isnt it?
Indeed the pulsar-client lib is not shading it, but is it the real issue?

If one were to pull spring-pulsar out of the equation and consume the pulsar-client lib directly, they would transitively consume the older version of protobuf-java which could cause problems.

@nandorholozsnyak
Copy link

Hi @onobc
Thank you so much for the info.

@onobc
Copy link
Collaborator Author

onobc commented Oct 16, 2024

Looks like this may get fixed in Pulsar proper as well: apache/pulsar#23468

@nandorholozsnyak
Copy link

Hehe, it is happening :D What a coincidence.

@onobc onobc added the type: improvement An improvement of implementation of existing feature label Oct 17, 2024
onobc added a commit to onobc/spring-pulsar that referenced this issue Oct 18, 2024
This commit excludes the `protobuf-java` unshaded transitive dependency
from the `pulsar-client-all` library. This allows the version of the
optional `protobuf-java` dependency to be controlled by `spring-pulsar`.

Resolves spring-projects#876
@onobc onobc closed this as completed in 0274632 Oct 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: dependency-upgrade A dependency upgrade type: improvement An improvement of implementation of existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants