运行arquillian测试时连接超时异常?

时间:2015-07-17 07:22:40

标签: wildfly jboss-arquillian

当我尝试运行arquillian测试时,我得到以下异常:

  

JBAS012144:无法连接到http-remoting://127.0.0.1:9990。该   连接超时

当我转到嵌入式wildfly并启动standalone.bat时,我可以连接到http://127.0.0.1:9990。是否有一些配置错误,它正在寻找http-remoting i.s.o. HTTP?或者我是否有其他错误配置?

这是arquillian.xml:

<?xml version="1.0" encoding="UTF-8"?>
<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="arquillian-wildfly82-embedded" default="true">
        <configuration>
            <property name="jbossHome">target/wildfly-8.2.0.Final</property>
            <property name="modulePath">target/wildfly-8.2.0.Final/modules</property>
            <property name="managementAddress">127.0.0.1</property>
            <property name="managementPort">9990</property>
        </configuration>
    </container>

</arquillian>

这是我的pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="
        http://maven.apache.org/POM/4.0.0
        http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <name>HouseKeeper</name>

    <groupId>com.viae.housekeeper</groupId>
    <artifactId>server</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

    <url/>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <resteasy.version>3.0.11.Final</resteasy.version>
    </properties>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.12</version>
            </plugin>
        </plugins>
    </build>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.jboss.arquillian</groupId>
                <artifactId>arquillian-bom</artifactId>
                <version>1.1.8.Final</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <!-- Java EE -->
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>7.0</version>
            <scope>provided</scope>
        </dependency>

        <!-- UTILS -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.4</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.5.10</version>
            <scope>test</scope>
        </dependency>

        <!-- DATABASE -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>4.3.10.Final</version>
            <exclusions>
                <exclusion>
                    <groupId>xml-apis</groupId>
                    <artifactId>xml-apis</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.36</version>
        </dependency>

        <!-- REST -->
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jaxrs</artifactId>
            <version>${resteasy.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
            <version>7.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.websocket</groupId>
            <artifactId>javax.websocket-api</artifactId>
            <version>1.1</version>
            <scope>provided</scope>
        </dependency>

        <!-- TESTING -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>1.10.19</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.arquillian.junit</groupId>
            <artifactId>arquillian-junit-container</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>arquillian-wildfy82-embedded</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <version>2.8</version>
                        <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>8.2.0.Final</version>
                                            <type>zip</type>
                                            <overWrite>false</overWrite>
                                            <outputDirectory>target</outputDirectory>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.18.1</version>
                        <configuration>
                            <!--forkMode>once</forkMode-->
                            <forkCount>1</forkCount>
                            <systemPropertyVariables>
                                <jboss.home>${project.basedir}/target/wildfly-8.2.0.Final</jboss.home>
                                <module.path>${project.basedir}/target/wildfly-8.2.0.Final/modules</module.path>
                                <arquillian.launch>arquillian-wildfly82-embedded</arquillian.launch>
                            </systemPropertyVariables>
                            <redirectTestOutputToFile>false</redirectTestOutputToFile>
                            <argLine>-Xmx512m -XX:MaxPermSize=256m -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Djboss.socket.binding.port-offset=100</argLine>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
            <dependencies>
                <dependency>
                    <groupId>org.wildfly</groupId>
                    <artifactId>wildfly-arquillian-container-embedded</artifactId>
                    <version>8.2.0.Final</version>
                </dependency>
                <dependency>
                    <groupId>org.wildfly</groupId>
                    <artifactId>wildfly-embedded</artifactId>
                    <version>8.2.0.Final</version>
                </dependency>
            </dependencies>
        </profile>
    </profiles>
</project>

1 个答案:

答案 0 :(得分:1)

您正在POM中指定端口偏移量:

-Djboss.socket.binding.port-offset=100

有效的网址是http://127.0.0.1:10090

删除pom文件中的端口偏移量或更改arquillian.xml中的端口。这应该可以解决问题。