2

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. 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?

Brian Clozel
  • 56,583
  • 15
  • 167
  • 176
Gilberto T.
  • 358
  • 6
  • 19
  • Could you provide more details regarding the issue. As far as I know WireMock has no dependencies to Spring. – Alex Oct 25 '22 at 23:30

1 Answers1

3

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/

Sam Hill
  • 46
  • 3