首页 > 解决方案 > 如何获得修复此错误的 Stacktrace?

问题描述

嘿,我尝试在 Kotlin Hands 上使用 Ktor。但是使用“/”访问网页时出现问题。

        embeddedServer(Netty, port) {
            install(FreeMarker) {
                templateLoader = ClassTemplateLoader(this::class.java.classLoader, "templates")
                outputFormat = HTMLOutputFormat.INSTANCE
            }
            routing {
                static("/static") {
                    resources("files")
                }
                get("/") {
                    call.respond(FreeMarkerContent("index.ftl", mapOf("entries" to blogEntries), ""))
                }
            }
        }.start(wait = false)

我使用了我的代码。我找不到错误,控制台中只有这条消息:

[eventLoopGroupProxy-4-1] INFO ktor.application - Unhandled: GET - /, io failed

有谁知道我该如何解决这个错误?

标签: javakotlinktor

解决方案


我建议使用CallLogging功能和路由跟踪来解决您的问题。


推荐阅读