使用Wildfly Embedded环境更改Arquillian中的默认端口

时间:2015-09-29 06:14:07

标签: java maven configuration wildfly jboss-arquillian

我在Arquillian + Wildfly Embedded服务器下运行集成测试。一切正常。但是当我在我的本地Wildfly运行时开始测试时,我会收到错误(当通过arquillian启动wildfly时,我尝试在测试中发送请求时):

ERROR [org.jboss.msc.service.fail] MSC000001: Failed to start service
jboss.serverManagement.controller.management.http:
org.jboss.msc.service.StartException in service
jboss.serverManagement.controller.management.http: JBAS015811: Failed
to start the http-interface service     at
org.jboss.as.server.mgmt.UndertowHttpManagementService.start(UndertowHttpManagementService.java:258)
[wildfly-server-8.2.1.Final.jar:8.2.1.Final]    at
org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
[jboss-msc-1.2.2.Final.jar:1.2.2.Final]     at
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
[jboss-msc-1.2.2.Final.jar:1.2.2.Final]     at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[rt.jar:1.8.0_45]   at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[rt.jar:1.8.0_45]   at java.lang.Thread.run(Thread.java:745)
[rt.jar:1.8.0_45] Caused by: java.lang.RuntimeException:
java.net.BindException: Address already in use  at
org.jboss.as.domain.http.server.ManagementHttpServer.start(ManagementHttpServer.java:156)
[wildfly-domain-http-interface-8.2.1.Final.jar:8.2.1.Final]     at
org.jboss.as.server.mgmt.UndertowHttpManagementService.start(UndertowHttpManagementService.java:224)
[wildfly-server-8.2.1.Final.jar:8.2.1.Final]    ... 5 more Caused by:
**java.net.BindException: Address already in use**

好吧,它的jboss.management.http.port属性负责端口更改(jboss.http.port已在我的环境中更改和使用,所以这不是原因),我修复了通过设置:

<argLine>-Djboss.http.port=8181 -Djboss.management.http.port=9999</argLine>
pom.xml中的

现在,当测试运行时,我可以看到使用了新的端口值:

INFO  [org.jboss.as] JBAS015961: Http management interface listening on http://127.0.0.1:9999/management 
INFO  [org.jboss.as] JBAS015951: Admin console listening on http://127.0.0.1:9999

但是,无论如何我得到了:

Caused by: java.net.ConnectException: JBAS012144: Could not connect to
**http-remoting://127.0.0.1:9990**. The connection timed out

看来,我可以强迫Wildfly使用另一个端口,9999,但是Arquillian对它一无所知。有没有办法通过在Arquillian测试中更改jboss.management.http.port来解决问题呢?理想情况下没有standalone-full.xml使用。

0 个答案:

没有答案