1.29
MAC JDK
No exception being thrown. I have a project that contains peer dependencies that use 1.28. I then installed a library that used 1.29. I force 1.29 on all the peer dependencies. I expect 1.29 to be backward compatible.
It looks like in 1.29 BaseDnsNameResolverProvider was removed. Is 1.29 backward compatible? would it break library dependencies that utilize 1.28?
java.lang.NoClassDefFoundError: io/grpc/internal/BaseDnsNameResolverProvider
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:370)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at io.grpc.ServiceProviders.loadAll(ServiceProviders.java:67)
at io.grpc.NameResolverRegistry.getDefaultRegistry(NameResolverRegistry.java:101)
at io.grpc.internal.AbstractManagedChannelImplBuilder.<init>(AbstractManagedChannelImplBuilder.java:107)
at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder.<init>(NettyChannelBuilder.java:136)
at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder.<init>(NettyChannelBuilder.java:131)
at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder.forAddress(NettyChannelBuilder.java:117)
at io.grpc.netty.shaded.io.grpc.netty.NettyChannelProvider.builderForAddress(NettyChannelProvider.java:37)
at io.grpc.netty.shaded.io.grpc.netty.NettyChannelProvider.builderForAddress(NettyChannelProvider.java:23)
at io.grpc.ManagedChannelBuilder.forAddress(ManagedChannelBuilder.java:39)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createSingleChannel(InstantiatingGrpcChannelProvider.java:270)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.access$1500(InstantiatingGrpcChannelProvider.java:71)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider$1.createSingleChannel(InstantiatingGrpcChannelProvider.java:202)
at com.google.api.gax.grpc.ChannelPool.create(ChannelPool.java:72)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createChannel(InstantiatingGrpcChannelProvider.java:209)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.getTransportChannel(InstantiatingGrpcChannelProvider.java:192)
at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:155)
at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:122)
at com.google.cloud.logging.spi.v2.GrpcLoggingRpc.<init>(GrpcLoggingRpc.java:132)
at com.google.cloud.logging.LoggingOptions$DefaultLoggingRpcFactory.create(LoggingOptions.java:61)
at com.google.cloud.logging.LoggingOptions$DefaultLoggingRpcFactory.create(LoggingOptions.java:55)
at com.google.cloud.ServiceOptions.getRpc(ServiceOptions.java:561)
at com.google.cloud.logging.LoggingOptions.getLoggingRpcV2(LoggingOptions.java:129)
at com.google.cloud.logging.LoggingImpl.<init>(LoggingImpl.java:109)
at com.google.cloud.logging.LoggingOptions$DefaultLoggingFactory.create(LoggingOptions.java:46)
at com.google.cloud.logging.LoggingOptions$DefaultLoggingFactory.create(LoggingOptions.java:41)
at com.google.cloud.ServiceOptions.getService(ServiceOptions.java:541)
at com.google.cloud.logging.logback.LoggingAppender.getLogging(LoggingAppender.java:245)
at com.google.cloud.logging.logback.LoggingAppender.start(LoggingAppender.java:207)
at com.snapchat.machamp.temporal_ctrl.logger.ConsoleJsonAppenderFactory.build(ConsoleJsonAppenderFactory.java:74)
at io.dropwizard.logging.DefaultLoggingFactory.configure(DefaultLoggingFactory.java:170)
at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:83)
at io.dropwizard.cli.Cli.run(Cli.java:78)
at io.dropwizard.Application.run(Application.java:94)
at com.snapchat.machamp.temporal_ctrl.TemporalCtrlApplication.main(TemporalCtrlApplication.java:37)
Caused by: java.lang.ClassNotFoundException: io.grpc.internal.BaseDnsNameResolverProvider
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 51 more
it seems to crash when

BaseDnsNameResolverProvider was our internal implementation that introduced in 1.25 for some specific feature and that was sort of temporary. In 1.29, we completed the full implementation so that was deleted. It is not part of public APIs (it's in io.grpc.internal) and your usage is already in a hack territory. You should avoid such usages to prevent potential breakages for dependency upgrade.
Oh sorry, my fault. The code snippet you are showing is not your code logic. You are not using BaseDnsNameResolverProvider directly. The problem is you are probably still not using 1.29 for all grpc modules involved. Could you please try ./gradlew dependencies to find out version divergence for grpc modules?
So I was able to get around my problem by forcing a downgrade of the peer dependency to 1.28. If I try to force it to 1.29, that is where it breaks.
Here is the sample build.gradle. I removed some things, but this is the core.
Notice grpcVersion. if it's set to 1.28, it will all work. if I set it to 1.29 it will throw the error.
All the libraries reference 1.28 and below, except 'io.temporal' which is 1.29.
I would expect that if I force everything to 1.29 it should still work if it's backward compatible.
plugins {
id 'com.github.johnrengelman.shadow' version '5.1.0'
id 'java'
}
apply plugin: 'application'
apply plugin: 'com.github.johnrengelman.shadow'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
maven {
url "https://oss.sonatype.org/content/repositories/snapshots/"
}
mavenCentral()
}
def grpcVersion = '1.29.0' // CURRENT_GRPC_VERSION
configurations.all {
resolutionStrategy {
force 'io.grpc:grpc-netty-shaded:' + grpcVersion
force 'io.grpc:grpc-protobuf:' + grpcVersion
force 'io.grpc:grpc-stub:' + grpcVersion
force 'io.grpc:grpc-netty:' + grpcVersion
force 'io.grpc:grpc-core:' + grpcVersion
force 'io.grpc:grpc-auth:' + grpcVersion
}
}
dependencies {
compile group: 'io.temporal', name: 'temporal-sdk', version: '0.20.0-SNAPSHOT'
compile group: 'com.google.http-client', name: 'google-http-client', version: '1.23.0'
// Required for GRPC to work
compile group: 'io.netty', name: 'netty-tcnative-boringssl-static', version: '2.0.30.Final'
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.30'
compile group: 'org.slf4j', name: 'log4j-over-slf4j', version: '1.7.30'
compile group: 'io.dropwizard', name: 'dropwizard-core', version: '2.0.8'
compile group: 'com.smoketurner', name: 'dropwizard-swagger', version: '2.0.0-1'
compile group: 'io.swagger.core.v3', name: 'swagger-core', version: '2.1.2'
compile group: 'ru.vyarus', name: 'dropwizard-guicey', version: '5.0.1'
compile group: 'com.google.inject', name: 'guice', version: '4.2.3'
compile group: 'org.glassfish.hk2', name: 'guice-bridge', version: '2.6.1'
compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-joda', version: '2.10.3'
compile group: 'com.google.cloud', name: 'google-cloud-logging', version:'1.101.1'
compile group: 'com.google.cloud', name: 'google-cloud-logging-logback', version: '0.117.0-alpha'
}
From your stacktrace, gax depends on grpc-alts with version being at most 1.28.1 (the latest release depends on 1.28.1). The dependency is grpc-alts --> grpc-grpclb --> grpc-core. You would need to make dependencies on this chain same grpc version. So, explicitly forcing grpc-alts and grpc-grpclb versions should fix the problem.
Following the above solution to clean up the dependencies should fix the problem. Closing now. Please let us know if you still have trouble making it work.