Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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)
like image 583
Vincent F Avatar asked Sep 03 '25 04:09

Vincent F


1 Answers

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 :

  • https://mvnrepository.com/artifact/org.wiremock/wiremock-standalone/3.2.0
  • https://mvnrepository.com/artifact/com.github.tomakehurst/wiremock-jre8-standalone/3.0.1
like image 196
Vincent F Avatar answered Sep 05 '25 01:09

Vincent F