我正在使用Arquillian测试jax-rs Web服务,我使用嵌入式Wildfly 10容器。这是我的pom.xml:
..
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.1.13.Final</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
...
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wildfly.arquillian</groupId>
<artifactId>wildfly-arquillian-container-embedded</artifactId>
<version>2.1.0.Final</version>
</dependency>
..
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<!-- You need the maven dependency plugin to download locally a zip with
the server, unless you provide your own, it will download under the /target
directory -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>process-test-classes</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-dist</artifactId>
<version>10.1.0.Final</version>
<type>zip</type>
<overWrite>false</overWrite>
<outputDirectory>target</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20.1</version>
<configuration>
<!-- Fork every test because it will launch a separate AS instance -->
<forkMode>always</forkMode>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
</systemPropertyVariables>
<redirectTestOutputToFile>false</redirectTestOutputToFile>
</configuration>
</plugin>
</plugins>
</build>
.. 使用src / test / resources中的arquillian.xml:
<arquillian xmlns="http://jboss.org/schema/arquillian"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
<container qualifier="wildfly10" default="true">
<configuration>
<property name="jbossHome">target/wildfly-10.1.0.Final/</property>
<property name="modulePath">target/wildfly-10.1.0.Final/modules</property>
</configuration>
</container>
.. 但是当输入: mvn clean verify 时,我收到以下错误: WFLYPRT0023:无法连接到远程+ http://127.0.0.1:9990。连接超时
答案 0 :(得分:0)
这个问题是我在 Google 中找到的第一个关于错误 WFLYPRT0023 的链接。
通过 jboss-cli 连接时遇到相同的错误代码,并通过在命令行上设置超时来修复它。
默认超时为 5000 毫秒,这似乎还不够,尤其是在网络速度较慢的情况下。
这将超时设置为 30 秒
jboss-cli.bat --timeout=30000 ...
就在 Arquillian 中设置而言,您应该能够添加
<块引用>startupTimeoutInSeconds
您的财产
<块引用>arquillian.xml
文件。我假设这个设置和上面的一样。
这里有一些关于 Arquillian 的更多信息Arquillian and Wildfly: set timeout for management connection