简体   繁体   中英

Arquillian managed test does no longer work since Wildfly 15

since a long time I work with Arquillian tests with Wildlfy. Currently I update from Wildfly 14 to Wildfly 17. But now, all the Arquillian tests fail. I reduced it to a single POM and arquillian.xml, mostly taken from tutorials and examples in the web and found out, all is working with Wildfly 14, not not with Wildfly 15, 16 or 17.

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>

    <groupId>org.jboss.arquillian</groupId>
    <artifactId>wildfly-arquillian-managed-example</artifactId>
    <version>1.0-SNAPSHOT</version>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.jboss.arquillian</groupId>
                <artifactId>arquillian-bom</artifactId>
                <version>1.5.0.Final</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
        </dependency>
        <dependency>
            <groupId>org.jboss.arquillian.junit</groupId>
            <artifactId>arquillian-junit-container</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wildfly</groupId>
            <artifactId>wildfly-arquillian-container-managed</artifactId>
            <version>8.2.1.Final</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>2.3.2</version>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
                        <forkMode>always</forkMode>
                        <systemPropertyVariables>
                            <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                        </systemPropertyVariables>
                        <redirectTestOutputToFile>false</redirectTestOutputToFile>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

</project>

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="wildfly" default="true">
        <configuration>
            <property name="jbossHome">D:\local_Source\Playground\Arquillian\wildfly-15.0.1.Final</property>
            <property name="javaVmArguments">--add-modules=java.se</property>
        </configuration>
    </container>
</arquillian>

The test is very simple. It's just a @Test method, with a System.out.println() code.

As told, changing the arquillian.xml to use Wildfly wildfly-14.0.1.Final, the test is successful, but starting with wildfly-15.0.1.Final, the application sever is starting up, but for the test method I get:

java.lang.IllegalArgumentException: ArquillianServletRunner not found. Could not determine ContextRoot from ProtocolMetadata, please contact DeployableContainer developer.
    at org.jboss.arquillian.protocol.servlet.ServletUtil.determineBaseURI(ServletUtil.java:61)
    at org.jboss.arquillian.protocol.servlet.ServletURIHandler.locateTestServlet(ServletURIHandler.java:54)
    at org.jboss.arquillian.protocol.servlet.ServletMethodExecutor.invoke(ServletMethodExecutor.java:76)
    at org.jboss.arquillian.container.test.impl.execution.RemoteTestExecuter.execute(RemoteTestExecuter.java:103)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    ...

Does anyone have any idea, what to change to get my arquillian tests working again?

OK, I found the answer. The problem is a wrong dependency in the pom.xml!

Wrong is:

<dependency>
    <groupId>org.wildfly</groupId>
    <artifactId>wildfly-arquillian-container-managed</artifactId>
    <version>8.2.1.Final</version>
    <scope>test</scope>
</dependency>

Right is:

<dependency>
    <groupId>org.wildfly.arquillian</groupId>
    <artifactId>wildfly-arquillian-container-managed</artifactId>
    <version>2.1.1.Final</version>
    <scope>test</scope>
</dependency>

I just googled for "wildfly-arquillian-container-managed" and used the highest version number. But this time, the higher number is an older state, probably in sync with Wildfly 8.2.1, but no longer working with Wildfly 15 or newer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM