Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

303
Vistas
Integration tests with WireMock failing because no ALPN Processors are found

I'm writing some integration tests for a Spring Boot application written in Kotlin. To stub some HTTP requests, I'm using WireMock via spring-cloud-contract-wiremock as dependency.

Some anonymized sample code from an integration test:

@SpringBootTest
@AutoConfigureMockMvc
@AutoConfigureWireMock
class MyIntegrationTest { 

    @Test
    fun `some test`() {
        mockEndpoint("url", 500, someResponseBodyInJson)

        mockMvc.perform(
            MockMvcRequestBuilders
                .post("url")
                .contentType(MediaType.APPLICATION_JSON.toString())
                .content(someRequestBodyInJson)
        )
            .andExpect(MockMvcResultMatchers.status().isInternalServerError)
    }

    private fun mockEndpoint(url: String, responseCode: Int, responseBody: String) {
        stubFor(
            WireMock.post(url).willReturn(
                WireMock.aResponse()
                    .withStatus(responseCode)
                    .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON.toString())
                    .withBody(responseBody)
            )
        )
    }

}

While running these tests on my local machine, everything is working fine. On the CI/CD environment it's failing though with the following error:

java.lang.IllegalStateException: No Server ALPNProcessors!
at wiremock.org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory.<init>(ALPNServerConnectionFactory.java:52)

I did some searching and figured out is has to do with Jetty missing some things on the class path. I added the following dependency testImplementation("org.eclipse.jetty:jetty-alpn-server:11.0.7"), but the tests are still failing. The alpn-boot extension should not be necessary as JDK 11 is being used.

Anyone able to help me solve this? Do I need another dependency or am I looking in the wrong direction?

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

Downgrade to Jetty 9.4.x

Wiremock does not support Jetty 10 or Jetty 11.

Also, Spring does not support Jetty 11 (which uses Jakarta EE 9 and Servlet 5.0 on the new namespace jakarta.servlet)

over 4 years ago · Santiago Trujillo Denunciar

0

Wiremock team addressed this in version 2.32, there's a ticket here. You need to specify a correct version for wiremock-jre8-standalone to override an older version pulled by Spring:

# Gradle
testImplementation 'com.github.tomakehurst:wiremock-jre8-standalone:2.32.0'

#Maven
<dependency>
    <groupId>com.github.tomakehurst</groupId>
    <artifactId>wiremock-jre8-standalone</artifactId>
    <version>2.32.0</version>
    <scope>test</scope>
</dependency>
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda