【问题标题】:WFLYPRT0023: Could not connect to remote+http://127.0.0.1:9990. The connection timed outWFLYPRT0023:无法连接到远程+http://127.0.0.1:9990。连接超时
【发布时间】:2017-09-20 15:04:09
【问题描述】:

我正在使用 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。连接超时

【问题讨论】:

  • 您是否验证过该端口上有任何东西在监听?您是否验证过您实际上可以从同一主机访问此地址?没有人能够轻松地为您解决此问题,因为它非常环保。所以你必须展示一些步骤来消除明显的东西。
  • 是的,该端口上没有监听任何东西....我不确定 wildfly 10 是否可以作为嵌入式容器运行
  • 看起来他们更改了 ID:developer.jboss.org/thread/267938?_sscc=t 如果这回答了问题,您可以自己回答,以获得一些甜蜜的代表。

标签: maven jboss-arquillian wildfly-10


【解决方案1】:

这个问题是我在 Google 中找到的关于错误 WFLYPRT0023 的第一个链接。

我在通过 jboss-cli 连接时得到了相同的错误代码,并通过在命令行上设置超时来修复它。

默认超时时间为 5000 毫秒,这似乎还不够,尤其是在网络速度较慢的情况下。

这会将超时设置为 30 秒

jboss-cli.bat --timeout=30000  ...

就在 Arquillian 中进行设置而言,您应该可以添加

startupTimeoutInSeconds

你的财产

arquillian.xml

文件。我假设这个设置和上面的一样。

这里有更多关于 Arquillian 的信息Arquillian and Wildfly: set timeout for management connection

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-02-08
    • 1970-01-01
    • 2019-06-15
    • 2019-03-02
    • 2019-10-20
    • 1970-01-01
    相关资源
    最近更新 更多