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

1.3K
Visualizações
Why do I get `Only one connection receive subscriber allowed` when the response has an HTTP error status code?

Within a rest request I send another request to a webservice using Spring WebClient and want to return the result to the caller:

return webClient.post()
  .uri(url)
  .body(...)
  .retrieve()
  .bodyToMono(String::class.java)
  .map { ResponseEntity.ok(it) }

Now it that webservice returns a HTTP error status code I receive the following error:

java.lang.IllegalStateException: Only one connection receive subscriber allowed.

When a status 200 code is returned, no error is thrown.

I also tried checking the status and throwing an exception myself, but the behavior is still the same:

return webClient.post()
  .uri(url)
  .body(...)
  .retrieve()
  .onStatus(HttpStatus::isError) { clientResonse ->
     clientResonse.bodyToMono(String::class.java)
        .map { RuntimeException(it) }
  }
  .bodyToMono(String::class.java)
  .map { ResponseEntity.ok(it) }

What am I doing wrong?

The code samples are in Kotlin but I assume every Java dev can read it :)

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

This is a known issue in Spring Framework and it's been fixed in Spring Framework 5.1.4 - see SPR-17564.

Unfortunately, I'm not aware of any workaround for this problem, so upgrading to Spring Framework 5.1.4 / Spring Boot 2.1.2 is the only solution so far.

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