问题描述
我使用扩展范围为kotlin
的在线工具创建了一个新的quarkus
项目.我能够执行./mvnw compile quarkus:dev
并在 http://localhost:8080 上卷曲.但是我在执行./mvnw test
时遇到以下异常.
I have created a new quarkus
project using online tool with kotlin
extenstion. I am able to execute ./mvnw compile quarkus:dev
and curl on http://localhost:8080. However I am getting following exception while executing ./mvnw test
.
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running dev.sanket.ExampleResourceTest
2020-02-20 14:06:27,010 INFO [io.quarkus] (main) Quarkus 1.2.1.Final started in 0.411s. Listening on: http://0.0.0.0:8081
2020-02-20 14:06:27,013 INFO [io.quarkus] (main) Profile test activated.
2020-02-20 14:06:27,013 INFO [io.quarkus] (main) Installed features: [cdi, kotlin, resteasy]
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 78.626 s <<< FAILURE! - in dev.sanket.ExampleResourceTest
[ERROR] testHelloEndpoint Time elapsed: 76.099 s <<< ERROR!
java.net.ConnectException: Operation timed out (Connection timed out)
你知道是什么原因造成的吗?
Any idea what is causing this?
推荐答案
默认配置 quarkus.http.host
是0.0.0.0
,如果要在仅处于测试阶段时以localhost身份运行它,则可以将其添加到属性文件中:
Default configuration for quarkus.http.host
is 0.0.0.0
, if you want to run it as localhost while you are only in test phase, then you can add this to your properties file :
这就像为某些配置文件指定一组属性.也可以将其应用于其他属性.
It is like specifying a set of properties for certain profile. It can be applied to other properties as well.
其他链接:在Quarkus中进行概要分析和配置.
这篇关于在执行mvn测试时,连接操作超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!