Hello Team. I have Spring Boot 3.3.6. I upgraded w...
# help
a
Hello Team. I have Spring Boot 3.3.6. I upgraded wiremock-standalone to 3.10.0 and my tests started to fail with exception:
Copy code
com.github.tomakehurst.wiremock.common.FatalStartupException: com.github.tomakehurst.wiremock.common.FatalStartupException: java.io.IOException: Failed to bind to /0.0.0.0:8080
	at com.github.tomakehurst.wiremock.WireMockServer.start(WireMockServer.java:171)
	at com.github.tomakehurst.wiremock.junit5.WireMockExtension.startServerIfRequired(WireMockExtension.java:216)
	at com.github.tomakehurst.wiremock.junit5.WireMockExtension.beforeAll(WireMockExtension.java:282)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Caused by: com.github.tomakehurst.wiremock.common.FatalStartupException: java.io.IOException: Failed to bind to /0.0.0.0:8080
	at com.github.tomakehurst.wiremock.jetty.JettyHttpServer.start(JettyHttpServer.java:149)
	at com.github.tomakehurst.wiremock.WireMockServer.start(WireMockServer.java:169)
	... 3 more
Caused by: java.io.IOException: Failed to bind to /0.0.0.0:8080
	at wiremock.org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:344)
	at wiremock.org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:304)
	at wiremock.org.eclipse.jetty.server.Server.lambda$doStart$0(Server.java:402)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
	at wiremock.org.eclipse.jetty.server.Server.doStart(Server.java:398)
	at wiremock.org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
	at com.github.tomakehurst.wiremock.jetty.JettyHttpServer.start(JettyHttpServer.java:144)
	... 4 more
Caused by: java.net.BindException: Address already in use
...
My Wiremock initialization config looks like this:
Copy code
@RegisterExtension
    static WireMockExtension wireMock = WireMockExtension.newInstance()
            .options(wireMockConfig()
                    .httpsPort(12345)
                    .keystorePath("src/test/resources/wiremock-key-store.jks")
                    .keystorePassword("SOME_PASS")
                    .keyManagerPassword("SOME_PASS")
                    .needClientAuth(true)
                    .trustStorePath("src/test/resources/wiremock-trust-store.jks")
                    .trustStorePassword("SOME_PASS")
            .build();
It was working correctly with version 3.9.2. Does something change with the newest version and some change in configuration is needed or it is a bug? I understand that it is saying the port is in use and that is why it is failing. However, I don't understand why it is using this port at all if I define in wirework configuration that I am using 12345 port?
t
It looks like you have something else running on port 8080. I suggest figuring out what that is before looking at whether it’s related to the version upgrade.
a
Yes, I do know that I have something else running on 8080 but it was not an issue before (before upgrade I also had something else running on 8080). That is why I assume that port 8080 was not used by Wiremock and something changed in the version?
t
The only thing that might have changed is adapter bindings. Perhaps having another process on 8080 worked because it and WireMock were targeting different network adaptors. I suggest 1) looking at what bindings the other process has, 2) explicitly binding WireMock to something other than what’s used in 1). OTOH, you’ll have a much easier time if you just pick a different port for WireMock to listen on.
a
Thanks for the answer and explanation. Went with suggestion to provide Wirework different port to listen.