wiremock: Wiremock does not work with Spring Boot 3.0.0
Hi, I would like to highlight an issue that I found out about today:
when using id("org.springframework.boot") version "3.0.0-M4"
I noticed that those imports are not present in JettyHttpServer
import javax.servlet.DispatcherType;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
causing Wiremock to fail on startup.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 28
- Comments: 29 (10 by maintainers)
@jwedel you can use standalone dependency in your test - this will make you independent from spring dependencies:
@GregoireW the problem with the standalone version is that it crashes on logging - there is a conflict with a logback from Spring Boot:
Caused by: java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class org.slf4j.helpers.NOPLoggerFactory loaded from file:/Users/user/.gradle/caches/modules-2/files-2.1/com.github.tomakehurst/wiremock-jre8-standalone/2.27.2/2f514e3a141617f0f4d32d272a07c0ab8fb8054e/wiremock-jre8-standalone-2.27.2.jar). If you are using WebLogic you will need to add 'org.slf4j' to prefer-application-packages in WEB-INF/weblogic.xml: org.slf4j.helpers.NOPLoggerFactorySame here
I had to use the standalone java in version 2.35.0
The standard jar had the same problem for me:
You can switch temporary to the wiremock-jre8-standalone it is an uber jar with dependencies package renamed except for a few of them. It should be ok for most application.
You can just head to https://slack.wiremock.org
@bhavyaSharma-appD (I’m not a wiremock maintainer so i speak only from what I observe) There is a wiremock 3.0 beta version which solve mains of the problem on springboot3 (the artifactID is back to wiremock) . (current version : com.github.tomakehurst :: wiremock :: 3.0.0-beta-8 )
I am also getting this logging issue. Is there a way to solve this?
I am also having the same issue even with wiremock-jre8:2.35.0
Yeah, I just discovered this too. I was checking the necessary steps in our project to prepare for the spring boot 3.0 release, and unfortunately, wiremock still builds with java 8 (for whatever reason), and when I checked, I saw it had the dependency to an old jetty version - v9.x(I think the most recent version is at least 11, which uses the corresponding jakarta.* libs).