Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

396
Visualizações
Ktor JSON Parsing on Post Request is not working

Every time I send a post request from the postman and the server gives this error, even I checked if I'm receiving Content-Type = Application/ JSON. But still giving this error.

Caused by: java.lang.NoSuchMethodError: java.nio.ByteBuffer.limit(I)Ljava/nio/ByteBuffer;

Here are my files

Application File:

fun main() {
    embeddedServer(Netty, port = 8080, host = "192.168.0.109") {
        install(ContentNegotiation){
            json()
        }
        configureRouting()
    }.start(wait = true)
}

Request:

post("/login") {

    val userInfo = call.receive<UserInfo>()
    println(userInfo)

    call.respondText("Everything is working fine")
}

Model Class:

@Serializable
data class UserInfo(
    val email: String,
    val password: String
)
over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

So I Solved This Issue by Changing Project SDK 1.8 to 11.

enter image description here

over 4 years ago · Santiago Trujillo Relatório

0

ktor_version:1.6.7 has fixed this problem.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda