sdk-codegen
sdk-codegen copied to clipboard
Missing dependency `io.ktor:ktor-client-gson` in Java Gradle example
I was able to make a test app inspired by the Java Gradle example, but I found that I couldn't get it to work at runtime unless I added a dependency.
It was one of the ktor dependencies.
Right now, the dependencies in the example include the following (for just ktor stuff):
implementation "io.ktor:ktor-client-okhttp:$ktorVersion"
implementation "io.ktor:ktor-client-json:$ktorVersion"
implementation "io.ktor:ktor-client-jackson:$ktorVersion"
I had to change these to:
implementation "io.ktor:ktor-client-okhttp:$ktorVersion"
implementation "io.ktor:ktor-client-json:$ktorVersion"
implementation "io.ktor:ktor-client-jackson:$ktorVersion"
implementation "io.ktor:ktor-client-gson:$ktorVersion"
Without this change, I get the following error at runtime:
Exception in thread "main" java.lang.NoClassDefFoundError: io/ktor/client/features/json/GsonSerializer
at com.looker.rtl.TransportKt$customClient$1$1.invoke(Transport.kt:184)
at com.looker.rtl.TransportKt$customClient$1$1.invoke(Transport.kt)
at io.ktor.client.HttpClientConfig$install$2.invoke(HttpClientConfig.kt:64)
at io.ktor.client.HttpClientConfig$install$2.invoke(HttpClientConfig.kt:18)
at io.ktor.client.features.json.JsonFeature$Feature.prepare(JsonFeature.kt:132)
at io.ktor.client.features.json.JsonFeature$Feature.prepare(JsonFeature.kt:128)
at io.ktor.client.HttpClientConfig$install$3.invoke(HttpClientConfig.kt:72)
at io.ktor.client.HttpClientConfig$install$3.invoke(HttpClientConfig.kt:18)
at io.ktor.client.HttpClientConfig.install(HttpClientConfig.kt:92)
at io.ktor.client.HttpClient.<init>(HttpClient.kt:168)
at io.ktor.client.HttpClient.<init>(HttpClient.kt:81)
at io.ktor.client.HttpClientKt.HttpClient(HttpClient.kt:43)
at com.looker.rtl.TransportKt.customClient(Transport.kt:182)
at com.looker.rtl.AuthSession.doLogin(AuthSession.kt:215)
at com.looker.rtl.AuthSession.login(AuthSession.kt:102)
at com.looker.rtl.AuthSession.login$default(AuthSession.kt:102)
at com.looker.rtl.AuthSession.getToken(AuthSession.kt:83)
at com.looker.rtl.AuthSession.authenticate(AuthSession.kt:66)
at com.looker.rtl.APIMethods$authRequest$1.invoke(APIMethods.kt:34)
at com.looker.rtl.APIMethods$authRequest$1.invoke(APIMethods.kt:32)
at com.looker.rtl.Transport.httpRequestBuilder(Transport.kt:322)
at com.looker.sdk.LookerSDK.update_session(methods.kt:17862)
at looker.api.sdk.java.test.App.main(App.java:28)
Caused by: java.lang.ClassNotFoundException: io.ktor.client.features.json.GsonSerializer
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
... 23 more
Caused by: java.lang.ClassNotFoundException: io.ktor.client.features.json.GsonSerializer
Env:
Java 17 (Temurin) Fedora 35