Closed dosier closed 1 year ago
I should note that running coroutines using my own defined CoroutineScope
works perfectly fine, e.g.
val searchScope = CoroutineScope(Dispatchers.IO)
authorSearchButton.apply {
disableWhen(authorSearchField.textProperty().isEmpty)
setOnAction {
searchScope.launch {
println("this is reached")
val searchProfileResponse = ScholarClient.fetchProfiles(authorSearchField.text)
println("this is not")
withContext(Dispatchers.JavaFx) {
authorListView.items.setAll(searchProfileResponse.profiles)
}
}
}
}
Here is the implementation of ScholarClient.fetchProfiles
:
// Crashes when it calls this method
suspend fun fetchProfiles(mauthors: String): SearchProfileResponse =
client.get(Endpoint.Profiles.makeUrl() + "&mauthors=$mauthors").body()
Similar issue: https://github.com/Kotlin/kotlinx.coroutines/issues/3032
The latest Kotlin version has Java module support.
Hello,
I'd like to preface that I am new to the module system introduced in Java 9, so bare with me if this is a silly question.
Context: I am building a GUI using JavaFX that interacts with an API through HTTP requests. I am using Ktor for the HTTP client. Goal: I want to use the JLink plugin to create an image of my app that others can run. Problem: When Ktor launches a coroutine, the application crashes with the following stack trace:
My initial configuration looked as follows:
Whenever I run the
:createMergedModule
Gradle task, I get the following warningsThis lead me to believe I have to manually provide merged module info, so I ran the
:suggestMergedModuleInfo
task and this gave me the following suggestions:When I include this in the
jlink { ... }
configuration block, the warning messages shown in the:createMergedModule
Gradle task are gone, however when I run the launcher in the generated image, I still get the same exception as before. It does run perfectly fine using the:run
task from theapplication
Gradle plugin.Could anyone shed some light on why this happens, and how I should go about fixing it?
Thanks!