Harry B
03/27/2021, 7:53 PM2021-03-27 19:53:03.556 [DefaultDispatcher-worker-1] ERROR Application - Unhandled exception caught for CoroutineName(call-handler)
kotlinx.coroutines.CoroutinesInternalError: Fatal exception in coroutines machinery for DispatchedContinuation[<http://Dispatchers.IO|Dispatchers.IO>, Continuation at io.ktor.server.engine.BaseApplicationResponse$respondWriteChannelContent$2$1.invokeSuspend(BaseApplicationResponse.kt:166)@4ed1ef02]. Please read KDoc to 'handleFatalException' method and report this incident to maintainers
at kotlinx.coroutines.DispatchedTask.handleFatalException$kotlinx_coroutines_core(DispatchedTask.kt:144)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:115)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class kotlinx.coroutines.CompletedExceptionally
at kotlinx.coroutines.CompletionStateKt.toState(CompletionState.kt:16)
at kotlinx.coroutines.CompletionStateKt.toState$default(CompletionState.kt:13)
at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:111)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
... 4 common frames omitted
When i run this function:
val ApplicationCall.accountPrincipal: AccountPrincipal? get() = authentication.principal<AccountPrincipal>()
fun ApplicationCall.user(): Account? = transaction<Account?> {
Account.find { (Accounts.id) eq accountPrincipal?.id }.firstOrNull()
}
Harry B
03/27/2021, 8:51 PMget("/me") {
val user = call.user;
if(user == null)
call.respond(HttpStatusCode.Unauthorized)
else
call.respond(HttpStatusCode.OK, mapOf(
"message" to "Account authenticated, data returned.",
"data" to user,
))
}
Harry B
03/27/2021, 8:51 PMinstall(ContentNegotiation) {
jackson {
enable(SerializationFeature.INDENT_OUTPUT)
dateFormat = DateFormat.getDateInstance()
}
}
Harry B
03/27/2021, 8:59 PM