java - 创建新项目后,Ktor 示例代码未运行
问题描述
我刚刚从idea(2.1.2.4416.7)的内置模板创建了一个ktor项目,当我在控制台中打开网页时出现以下错误:
2021-06-27 12:16:34.158 [main] INFO ktor.application - Responding at http://0.0.0.0:8080
2021-06-27 12:16:41.583 [eventLoopGroupProxy-4-1] TRACE ktor.application - Failed to decode request
java.lang.IllegalArgumentException: text is empty (possibly HTTP/0.9)
at io.netty.handler.codec.http.HttpVersion.valueOf(HttpVersion.java:64)
at io.netty.handler.codec.http.HttpRequestDecoder.createMessage(HttpRequestDecoder.java:95)
at io.netty.handler.codec.http.HttpObjectDecoder.decode(HttpObjectDecoder.java:249)
at io.netty.handler.codec.http.HttpServerCodec$HttpServerRequestDecoder.decode(HttpServerCodec.java:123)
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:508)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:447)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.ktor.server.netty.EventLoopGroupProxy$Companion.create$lambda-1$lambda-0(NettyApplicationEngine.kt:251)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:829)
有任何想法吗?它使用 java 版本 11、gradle 版本 7.1 和 kotlin 版本 1.6。
这是 github 上的源代码: https ://github.com/Digital-Nomad/thedrewreport
解决方案
推荐阅读
- xmpp - 在android中制作聊天应用程序的最佳服务器是什么?
- screeps - 是否有可能让小兵交换位置同时移动?
- iis-8 - 通过 Visual Studio 和 Plesk 使用 Web 部署
- javascript - 为 jQuery/javascript 中的顺序更新锁定变量
- sql - SQL Server - JSON 类型枚举
- tensorflow - Tensorflow 提供了哪些管理模型输入参数的机制?
- strongloop - 环回 REST API 路径
- mongodb - 如何在laravel的mongodb服务器中获取所有数据库名称
- visual-studio - VSTS - 与 TIA 构建的依赖映射不起作用
- git - 取消跟踪文件但不删除它