Hi Ktor team, seems like the latest <kotlinx html>...
# ktor
s
Hi Ktor team, seems like the latest kotlinx html breaks ktor 3.0.3
Copy code
Request: /swagger
2025-01-16 20:14:29.668 PST trace-id-00000 ERROR localhost [eventLoopGroupProxy-4-1]  Application - Internal Server Error
java.lang.NoSuchMethodError: kotlinx.html.Gen_attr_traitsKt.setId(kotlinx.html.CommonAttributeGroupFacade, java.lang.String)
        at io.ktor.server.plugins.swagger.SwaggerKt$swaggerUI$5$2.invokeSuspend$lambda$9(Swagger.kt:91) ~[jvm:3.0.3]
        at io.ktor.server.html.RespondHtmlKt.respondHtml(RespondHtml.kt:63) ~[jvm:3.0.3]
        at io.ktor.server.html.RespondHtmlKt.respondHtml$default(RespondHtml.kt:21) ~[jvm:3.0.3]
        at io.ktor.server.plugins.swagger.SwaggerKt$swaggerUI$5$2.invokeSuspend(Swagger.kt:79) ~[jvm:3.0.3]
        at io.ktor.server.plugins.swagger.SwaggerKt$swaggerUI$5$2.invoke(Swagger.kt) ~[jvm:3.0.3]
        at io.ktor.server.plugins.swagger.SwaggerKt$swaggerUI$5$2.invoke(Swagger.kt) ~[jvm:3.0.3]
a
Can you share a code snippet to reproduce the
NoSuchMethodError
?
s
@Aleksei Tirman [JB] i think this is coming from swaggerUI
Copy code
swaggerUI(path = "swagger", swaggerFile = "openapi/documentation.yaml") {
    version = BuildConfig.swaggerUi
    customStyle(BuildConfig.swaggerStyle)
  }
a
Unfortunately, I cannot reproduce the
NoSuchMethodError
using the listed code snippet. Can you check that your project doesn't contain conflicting (2.* and 3.*) versions of Ktor?
c
@suresh are you in a multiplatform environment? I've got exactly the same error.
s
@Chris it’s a multiplatform project (jvm, js & native), but the ktor app is running on jvm.
c
Same for me (i'm new to multiplatform). Maybe that's some regression in
kotlin("jvm")
?
I wonder why we are the only two haven this problem 🤔
s
@Chris jfyi..the issue is fixed in ktor 3.1.0