v6: the "all" jar leaves com.google.rpc/api/type unrelocated but compiled against the shaded protobuf

Open
#632 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
grpc, java

Research direction

Start by locating the build configuration that creates the all classifier jar and inspect its protobuf relocation rules. Reproduce the classpath conflict with the Java snippet and dependency versions in the issue, then trace which packaged classes remain under com.google.*. Done means the all jar no longer exposes those classes with bytecode linked to shaded protobuf, and the reproduction works with either classpath order.

Written by the indexing model from the issue text.

Description

Summary

The all classifier jar relocates protobuf to io.weaviate.shaded.com.google.protobuf, but keeps com.google.rpc.*, com.google.api.*, com.google.type.* and com.google.longrunning.* (from proto-google-common-protos, about 940 classes) under their original package names, with their bytecode rewritten to extend the shaded protobuf.

Any application that also has proto-google-common-protos on its classpath ends up with two incompatible classes of the same name. That includes anything using gRPC's grpc-protobuf or a Google Cloud client library. Whichever jar comes first wins, and the other side breaks.

Reproduction (client6-6.3.2-all.jar, JDK 17)

Object s = com.google.rpc.Status.newBuilder().setCode(5).build();
System.out.println(s.getClass().getSuperclass().getName());
System.out.println(s instanceof com.google.protobuf.Message);
Classpath order superclass instanceof Message
client6-6.3.2-all.jar, proto-google-common-protos-2.62.0, protobuf-java-3.25.8 io.weaviate.shaded.com.google.protobuf.GeneratedMessageV3 false
proto-google-common-protos-2.62.0, protobuf-java-3.25.8, client6-6.3.2-all.jar com.google.protobuf.GeneratedMessageV3 true

The jar also carries unrelocated Guava, Gson, Nimbus JOSE/OAuth, Apache HttpClient 5 and commons-lang3, which can collide the same way in any application that has its own versions of them.

Expected

Relocate everything that is compiled against the shaded protobuf (at least com.google.rpc, com.google.api, com.google.type, com.google.longrunning), and ideally the other bundled libraries too. Otherwise the all jar is only safe in an application with no other Google/gRPC dependencies.

Related but separate: #422.

Dominant language
Java
Stars
34
Forks
31
Avg merge
2d 10h
Merged PRs (30d)
2

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from weaviate/java-client

All issues in weaviate/java-client

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.