Hi everyone, I'm seeing this weird behaviour with ...
# ktor
h
Hi everyone, I'm seeing this weird behaviour with ktor-jetty server where when running the code via the commandline, the program log doesn't include any thread name that belong to the jetty server, here is an example:
Copy code
Nov 02 06:53:48 backend-server java[675013]: Routing resolve result:
Nov 02 06:53:48 backend-server java[675013]:   SUCCESS @ /api/posts/(method:POST)
Nov 02 06:53:48 backend-server java[675013]: This is session null
Nov 02 06:53:48 backend-server java[675013]: 2025-11-02 06:53:48.248 [eventLoopGroupProxy-4-2] TRACE i.k.server.engine.DefaultTransform - Transformed class io.ktor.utils.io.ByteChannel to class io.ktor.http.cio.CIOMultipartDataBase for /api/pos>
Nov 02 06:53:48 backend-server java[675013]: 2025-11-02 06:53:48.249 [eventLoopGroupProxy-4-2] ERROR Application - Unhandled: POST - /api/posts
Nov 02 06:53:48 backend-server java[675013]: java.lang.NullPointerException: null
Nov 02 06:53:48 backend-server java[675013]:         at com.yourart.RoutingKt$configureRouting$1$5.invokeSuspend(Routing.kt:155)
Nov 02 06:53:48 backend-server java[675013]:         at com.yourart.RoutingKt$configureRouting$1$5.invoke(Routing.kt)
Nov 02 06:53:48 backend-server java[675013]:         at com.yourart.RoutingKt$configureRouting$1$5.invoke(Routing.kt)
Nov 02 06:53:48 backend-server java[675013]:         at io.ktor.server.routing.RoutingNode$buildPipeline$1$1.invokeSuspend(RoutingNode.kt:126)
Nov 02 06:53:48 backend-server java[675013]:         at io.ktor.server.routing.RoutingNode$buildPipeline$1$1.invoke(RoutingNode.kt)
This is when I'm running the code locally via Intellij:
Copy code
Routing resolve result:
  SUCCESS @ /api/posts/(method:POST)
This is session null
2025-11-02 18:29:27.989 [ktor-jetty-8000-1] TRACE i.k.server.engine.DefaultTransform - Transformed class io.ktor.utils.io.ByteChannel to class io.ktor.http.cio.CIOMultipartDataBase for /api/posts
2025-11-02 18:29:28.026 [ktor-jetty-8000-3] TRACE a.s.k.r.h.operation.OperationHandler - operation started
2025-11-02 18:29:28.053 [ktor-jetty-8000-4] DEBUG a.s.k.r.a.c.ProfileCredentialsProvider - Loading credentials from profile `default`
2025-11-02 18:29:28.062 [ktor-jetty-8000-4] DEBUG a.s.k.r.a.c.ProfileCredentialsProvider - Resolving credentials from static credentials
Does anyone know why this is the case? Thanks in advance
a
It appears that a different SLF4J provider or configuration is used when the server is started from the CLI compared to when it’s run from IntelliJ IDEA.
👍 1