Issue
I'm preparing to the migration of a Spring Boot service to Spring Boot 3 (I'm trying version 3.0.0-RC1
) and unfortunately I'm facing the lack of SocketUtils
that has been removed.
This means that some libraries that I'm using for testing (e.g. href="https://wiremock.org/" rel="nofollow noreferrer">WireMock) don't work. I'm following Introduce TestSocketUtils as a replacement for SocketUtils #28210 hoping it will resume some tests that currently fail to load.
Do you know some workarounds or other tools I can use in the meanwhile to test the service at the API layer?
Solution
I was hitting the same issue causing this exception:
java.lang.NoClassDefFoundError: org/springframework/util/SocketUtils
The fix for me was to upgrade the spring-cloud-contract-wiremock dependency to 4.0.0-M5.
I also had to add this into my pom as the version wasn't available otherwise:
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
I didn't try any earlier versions to see where the fix was introduced, but you can find them here: https://repo.spring.io/ui/native/milestone/org/springframework/cloud/spring-cloud-contract-wiremock/
Answered By - Sam Hill
Answer Checked By - Timothy Miller (JavaFixing Admin)