Arquillian with Wildfly 8.0.0.Final Managed not working

时间:2014-03-21 19:16:08

标签: jboss-arquillian wildfly

我一直在和jboss-as-7.1.1.Final一起使用arquillian。

我想开始使用wildfly 8.0.0.Final,但我无法让它工作。

我只更改了我的pom.xml和arquillian.xml。

这是我的“财产”:

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <version.joda.time>2.1</version.joda.time>
    <version.junit>4.11</version.junit>
    <version.mockito>1.9.5</version.mockito>
    <version.jacoco>0.6.0.201210061924</version.jacoco>
    <version.arquillian.bom>1.1.3.Final</version.arquillian.bom>
    <version.arquillian.drone.bom>1.3.0.Final</version.arquillian.drone.bom>
    <version.arquillian.jacoco>1.0.0.Alpha6</version.arquillian.jacoco>
    <version.arquillian.persistence>1.0.0.Alpha6</version.arquillian.persistence>
    <version.commons.collections>3.2.1</version.commons.collections>
    <version.commons.io>2.4</version.commons.io>
    <version.wildfly>8.0.0.Final</version.wildfly>
    <!-- <version.jbpm.3>3.3.1.GA</version.jbpm.3> -->
</properties>

相关的maven个人资料声明如下:

    <profile>
        <id>arquillian-wildfly-managed</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <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>${version.wildfly}</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.16</version>
                    <configuration>
                        <systemPropertyVariables>
                            <arquillian.launch>wildfly-as-managed</arquillian.launch>
                        </systemPropertyVariables>
                    </configuration>
                </plugin>
            </plugins>
            <pluginManagement>
                <plugins>
                    <!-- Ignore/Execute plugin execution -->
                    <plugin>
                        <groupId>org.eclipse.m2e</groupId>
                        <artifactId>lifecycle-mapping</artifactId>
                        <version>1.0.0</version>
                        <configuration>
                            <lifecycleMappingMetadata>
                                <pluginExecutions>
                                    <!-- copy-dependency plugin -->
                                    <pluginExecution>
                                        <pluginExecutionFilter>
                                            <groupId>org.apache.maven.plugins</groupId>
                                            <artifactId>maven-dependency-plugin</artifactId>
                                            <versionRange>[1.0.0,)</versionRange>
                                            <goals>
                                                <goal>unpack</goal>
                                            </goals>
                                        </pluginExecutionFilter>
                                        <action>
                                            <execute />
                                        </action>
                                    </pluginExecution>
                                </pluginExecutions>
                            </lifecycleMappingMetadata>
                        </configuration>
                    </plugin>
                </plugins>
            </pluginManagement>
            <testResources>
                <testResource>
                    <directory>src/test/resources</directory>
                </testResource>
            </testResources>
        </build>
        <dependencies>
            <dependency>
                <groupId>org.wildfly</groupId>
                <artifactId>wildfly-dist</artifactId>
                <version>${version.wildfly}</version>
                <type>zip</type>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.jboss</groupId>
                <artifactId>jboss-common-core</artifactId>
                <version>2.2.17.GA</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.jboss.marshalling</groupId>
                <artifactId>jboss-marshalling-river</artifactId>
                <version>1.4.0.Final</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </profile>

这是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">

<defaultProtocol type="Servlet 3.0" />

<container
    qualifier="wildfly-as-managed"
    default="true">
    <configuration>
        <property name="jbossHome">target/wildfly-8.0.0.Final</property>
        <property name="javaVmArguments">-Djboss.socket.binding.port-offset=9 -Djboss.management.native.port=9080 -Xmx512m -XX:MaxPermSize=512m</property>
        <property name="managementPort">9090</property>
    </configuration>
</container>
<extension qualifier="persistence-dbunit">
    <property name="defaultDataSetFormat">YAML</property>
</extension>
</arquillian>

这是完整的错误堆栈跟踪:

java.lang.RuntimeException: Could not create new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor
    at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:160)
    at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:111)
    at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:97)
    at org.jboss.arquillian.test.spi.TestRunnerAdaptorBuilder.build(TestRunnerAdaptorBuilder.java:52)
    at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:93)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:156)
    ... 10 more
Caused by: org.jboss.arquillian.container.impl.ContainerCreationException: Could not create Container wildfly-as-managed
    at org.jboss.arquillian.container.impl.LocalContainerRegistry.create(LocalContainerRegistry.java:85)
    at org.jboss.arquillian.container.impl.client.container.ContainerRegistryCreator.createRegistry(ContainerRegistryCreator.java:76)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
    at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
    at org.jboss.arquillian.core.impl.ManagerImpl.bindAndFire(ManagerImpl.java:236)
    at org.jboss.arquillian.core.impl.InstanceImpl.set(InstanceImpl.java:74)
    at org.jboss.arquillian.config.impl.extension.ConfigurationRegistrar.loadConfiguration(ConfigurationRegistrar.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
    at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
    at org.jboss.arquillian.core.impl.ManagerImpl.start(ManagerImpl.java:261)
    at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.<init>(EventTestRunnerAdaptor.java:56)
    ... 15 more
Caused by: java.lang.IllegalArgumentException: DeployableContainer must be specified
    at org.jboss.arquillian.core.spi.Validate.notNull(Validate.java:44)
    at org.jboss.arquillian.container.impl.ContainerImpl.<init>(ContainerImpl.java:71)
    at org.jboss.arquillian.container.impl.LocalContainerRegistry.create(LocalContainerRegistry.java:76)
    ... 39 more

2 个答案:

答案 0 :(得分:5)

我无法在您的个人资料中找到任何arquillian容器依赖项,并且堆栈跟踪看起来像arquillian无法找到要使用的容器。您是否忘记将容器添加到依赖项中?

试试这个:

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

答案 1 :(得分:-1)

正如支持网址中提到的那样 https://docs.jboss.org/author/display/ARQ/Container+adapters 野生蝇不支持arquilliian managed。相反,只支持嵌入式。