You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I generated a sample code as given in the Google cloud functions guide. Then I added a dependency for quarkus-rest-jackson. No code changes were made. When running tests using ./mvnw clean test, I get the below Failed to bind exception for all three sample test cases:
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.462 s <<< FAILURE! -- in org.acme.googlecloudfunctions.HelloWorldCloudEventsFunctionTest
[ERROR] org.acme.googlecloudfunctions.HelloWorldCloudEventsFunctionTest.testAccept -- Time elapsed: 0.001 s <<< ERROR!
org.junit.jupiter.api.extension.TestInstantiationException: Failed to create test instance
at io.quarkus.test.junit.QuarkusTestExtension.initTestState(QuarkusTestExtension.java:788)
at io.quarkus.test.junit.QuarkusTestExtension.interceptTestClassConstructor(QuarkusTestExtension.java:754)
at java.base/java.util.Optional.orElseGet(Optional.java:364)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Caused by: java.lang.RuntimeException: java.io.IOException: Failed to bind to 0.0.0.0/0.0.0.0:8081
at io.quarkus.google.cloud.functions.test.CloudFunctionTestResource.inject(CloudFunctionTestResource.java:40)
at io.quarkus.test.common.TestResourceManager.inject(TestResourceManager.java:166)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at io.quarkus.test.junit.QuarkusTestExtension.createActualTestInstance(QuarkusTestExtension.java:799)
at io.quarkus.test.junit.QuarkusTestExtension.initTestState(QuarkusTestExtension.java:782)
... 4 more
Caused by: java.io.IOException: Failed to bind to 0.0.0.0/0.0.0.0:8081
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:349)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:310)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:234)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
at org.eclipse.jetty.server.Server.doStart(Server.java:401)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
at com.google.cloud.functions.invoker.runner.Invoker.startServer(Invoker.java:324)
at com.google.cloud.functions.invoker.runner.Invoker.startTestServer(Invoker.java:276)
at io.quarkus.google.cloud.functions.test.CloudFunctionsInvoker.start(CloudFunctionsInvoker.java:26)
at io.quarkus.google.cloud.functions.test.CloudFunctionTestResource.inject(CloudFunctionTestResource.java:38)
... 8 more
Caused by: java.net.BindException: Address already in use
at java.base/sun.nio.ch.Net.bind0(Native Method)
at java.base/sun.nio.ch.Net.bind(Net.java:555)
at java.base/sun.nio.ch.ServerSocketChannelImpl.netBind(ServerSocketChannelImpl.java:337)
at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:294)
at java.base/sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:89)
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:344)
... 18 more
I have already verified that the port 8081 isn't used by any other application (using sudo netstat -tunlp). I still tried using a random test port by modifying the application.properties file, but it doesn't seem to help.
All I can tell after some digging is that transitive dependency quarkus-vertx-http seems to be causing this issue. One good thing is that this sample application runs just fine once built using -DskipTests.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I generated a sample code as given in the Google cloud functions guide. Then I added a dependency for
quarkus-rest-jackson
. No code changes were made. When running tests using./mvnw clean test
, I get the belowFailed to bind
exception for all three sample test cases:I have already verified that the port
8081
isn't used by any other application (usingsudo netstat -tunlp
). I still tried using a random test port by modifying theapplication.properties
file, but it doesn't seem to help.All I can tell after some digging is that transitive dependency
quarkus-vertx-http
seems to be causing this issue. One good thing is that this sample application runs just fine once built using-DskipTests
.Could somebody please help me here? I made a small reproducer which is available at https://github.com/zbhavyai/quarkus-failed-to-bind-reproducer. I am using Quarkus
3.11.1
with JDK17.0.11
on Fedora Workstation40
.Thank you.
Beta Was this translation helpful? Give feedback.
All reactions