When spinning up a Spring boot application on Intellij, that tries to connect the GCP's BigTable, we get the following error:
java.lang.NoClassDefFoundError: io/grpc/internal/BaseDnsNameResolverProvider
This is the stack trace:
...nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.google.cloud.bigtable.data.v2.BigtableDataClient]: Factory method 'bigtableDataClient' threw exception; nested exception is java.lang.NoClassDefFoundError: io/grpc/internal/BaseDnsNameResolverProvider
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:797) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:227) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1358) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
....
The import in Gradle is:
implementation 'com.google.cloud:google-cloud-bigtable:1.13.0'
Update:
I tried to specifically use a different grpc-alt version:
compile group: 'io.grpc', name: 'grpc-alts', version: '1.29.0'
But it did not help.
If I try to run the app from the Gradle command of bootRun it spins up with no problem. Only when trying to start it in the Intellij it faces the same issue.