spring-bootwiremock

wiremock issue when upgrading to Spring Boot 3


When upgrading my Spring Boot 2.5 to 3.0 , I am facing some issues with Wiremock, probably due to the move to jakarta namespace. Even upgrading to latest wiremock-jre8 , ie 2.35.0 (as of december 2022) doesn't seem to help. I get this error :

java.lang.NoClassDefFoundError: javax/servlet/DispatcherType

    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:375)
    at com.github.tomakehurst.wiremock.jetty9.JettyHttpServerFactory.getServerConstructor(JettyHttpServerFactory.java:37)
    at com.github.tomakehurst.wiremock.jetty9.JettyHttpServerFactory.<clinit>(JettyHttpServerFactory.java:30)

Solution

  • Looks like this is a know issue related to jakarta namespace and Jetty 11 support, that will take a while to get properly fixed :

    https://github.com/wiremock/wiremock/issues/1760

    As indicated in the issue, using wiremock-jre8-standalone instead of wiremock-jre8 helps working around the issue, until it gets properly fixed in Wiremock 3.x

    Edit, Oct 2023 : these are now available and should help :