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

NettyChannelBuilder can't locate the name resolver provider from service files when build with minimize shadowJar #926

Open
ee07b415 opened this issue Jul 23, 2024 · 0 comments

Comments

@ee07b415
Copy link

Please check the User Guide before submitting "how do I do 'x'?" questions!

Shadow Version

7.1.2

Gradle Version

7.6.4

Expected Behavior

The grpc managed channel can start connection without any problem.

Actual Behavior

After add the minimize () to the shadowJar task, the execution start to saw error like:
io.grpc.NameResolverProvider: io.grpc.netty.UdsNameResolverProvider not a subtype

When I unzip the jar file I can find the io.grpc.NameResolveProvider file and the content:
io.grpc.netty.UdsNameResolverProvider
io.grpc.internal.DnsNameResolverProvider
io.grpc.googleapis.GoogleCloudToProdExperimentalNameResolverProvider
io.grpc.googleapis.GoogleCloudToProdNameResolverProvider
io.grpc.grpclb.SecretGrpclbNameResolverProvider$Provider
io.grpc.netty.shaded.io.grpc.netty.UdsNameResolverProvider

So I think after enable the minimize, the class in jar file can't read from the metadata-INF files for the class it needed, so I'm not sure how to config the minize to include resource file

Gradle Build Script(s)

configurations {
val flinkShadowJar = create("flinkShadowJar")
flinkShadowJar.apply {
extendsFrom(configurations.runtimeClasspath.get())
}
}

tasks.shadowJar {
archiveBaseName.set("flink-job")
archiveVersion.set("1.0-SNAPSHOT")
archiveClassifier.set("")
minimize ()
mergeServiceFiles ()
isZip64 = true
configurations = listOf(project.configurations.getByName("flinkShadowJar"))
}

Content of Shadow JAR (jar tf <jar file> - post link to GIST if too long)

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

No branches or pull requests

1 participant