Skip to content

Conversation

@bevzzz
Copy link
Collaborator

@bevzzz bevzzz commented Jul 26, 2025

Resolves #422

Problem

Trying to java -jar a fat JAR built with something like maven-assembly-plugin users will see this error as soon as they try to instantiate WeaviateClient:

Exception in thread "main" java.lang.IllegalArgumentException: Address types of NameResolver 'unix' for 'grpc-
blahblahblah.gcp.weaviate.cloud:443' not supported by transport
        at io.grpc.internal.ManagedChannelImplBuilder.getNameResolverProvider(ManagedChannelImplBuilder.java:8
50)
        at io.grpc.internal.ManagedChannelImplBuilder.build(ManagedChannelImplBuilder.java:700)
        at io.grpc.ForwardingChannelBuilder2.build(ForwardingChannelBuilder2.java:272)
        at io.weaviate.client6.v1.internal.grpc.DefaultGrpcTransport.buildChannel(DefaultGrpcTransport.java:92
)
        at io.weaviate.client6.v1.internal.grpc.DefaultGrpcTransport.<init>(DefaultGrpcTransport.java:24)
        at io.weaviate.client6.v1.api.WeaviateClient.<init>(WeaviateClient.java:26)
        at io.weaviate.client6.v1.api.WeaviateClient.custom(WeaviateClient.java:54)

After some investigation (and with invaluable help from @Dabz) the problem is this:

io.grpc uses META-INF/services to dynamically load NameResolver providers. When building a fat JAR, plugins like maven-assembly-plugin won't merge overlapping config files without an additional configuration on the end-user's side.

This comment is also very insightful.

Solution

While configuring the plugin is not difficult and we could document this in our README, we will do our users one better:
using maven-shade-plugin we can distribute a shaded version of client6 with all its' dependencies' configurations resolved in advance (in addition to the 'slim' version of the lib).

Now, when trying to build a fat JAR all that our users will need to do is include <classifier>all</classifier> tag to client6 block.

<dependency>
  <groupId>io.weaviate</groupId>
  <artifactId>client6</artifactId>
  <version>6.0.0-XXX</artifactId>
  <classifier>all</classifier>
<dependency>

io.grpc uses META-INF/services to dynamically load NameResolver providers.
When building a fat JAR, plugins like maven-assembly-plugin won't merge overlapping
config files without an additional configuration on the end-user's side.

While configuring the plugin is not difficult and we could document this
in our README, we will do our users one better:
using maven-shade-plugin we can distribute a shaded version of client6 with
all its' dependencies' configurations resolved in advance (in addition to
the 'slim' version of the lib).

Now, when trying to build a fat JAR all that our users will need to do
is include <classifier>all</classifier> tag to client6 <dependency> block.
@bevzzz bevzzz requested a review from antas-marcin July 26, 2025 15:15
Copy link

@orca-security-eu orca-security-eu bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca

@bevzzz bevzzz requested a review from Dabz July 26, 2025 15:15
@bevzzz bevzzz self-assigned this Jul 26, 2025
@bevzzz bevzzz linked an issue Jul 26, 2025 that may be closed by this pull request
@bevzzz
Copy link
Collaborator Author

bevzzz commented Jul 26, 2025

I'll add some documentation for this on Monday.

@bevzzz bevzzz merged commit 4f8246e into v6 Jul 30, 2025
2 checks passed
@bevzzz bevzzz deleted the v6-shade-for-uber-jar branch July 30, 2025 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Include missing gRPC classes when creating a fat JAR

3 participants