Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Junit Arquillian:多次尝试注册同一观察者,ServerSetupObserver_Junit_Ejb_Cdi_Wildfly 8_Jboss Arquillian - Fatal编程技术网

Junit Arquillian:多次尝试注册同一观察者,ServerSetupObserver

Junit Arquillian:多次尝试注册同一观察者,ServerSetupObserver,junit,ejb,cdi,wildfly-8,jboss-arquillian,Junit,Ejb,Cdi,Wildfly 8,Jboss Arquillian,我试图用wildfly配置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.ja

我试图用wildfly配置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:165).......
Caused by: java.lang.reflect.InvocationTargetException: null
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    ...........
Caused by: java.lang.RuntimeException: Could not create new instance of class org.jboss.arquillian.core.impl.ManagerImpl
    at org.jboss.arquillian.core.spi.SecurityActions.newInstance(SecurityActions.java:165)
    at .................
Caused by: java.lang.reflect.InvocationTargetException: null
    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:526)
    at ...............
Caused by: java.lang.RuntimeException: Could not create and process manager
    at org.jboss.arquillian.core.impl.ManagerImpl.<init>(ManagerImpl.java:105)......
Caused by: java.lang.IllegalArgumentException: Attempted to register the same Observer: org.jboss.as.arquillian.container.ServerSetupObserver multiple times, please check classpath for conflicting jar versions
    at org.jboss.arquillian.core.impl.ManagerImpl$2.observer(ManagerImpl.java:354)
    at org.jboss.arquillian.core.impl.loadable.LoadableExtensionLoader$1.observer(LoadableExtensionLoader.java:101)
    at org.jboss.as.arquillian.container.CommonContainerExtension.register(CommonContainerExtension.java:41)
    at org.jboss.as.arquillian.container.remote.RemoteContainerExtension.register(RemoteContainerExtension.java:33)
java.lang.RuntimeException:无法创建类org.jboss.arquillian.test.impl.EventTestRunGenerator的新实例
在org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:165)。。。。。。。
原因:java.lang.reflect.InvocationTargetException:null
位于sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法)
...........
原因:java.lang.RuntimeException:无法创建类org.jboss.arquillian.core.impl.ManagerImpl的新实例
位于org.jboss.arquillian.core.spi.SecurityActions.newInstance(SecurityActions.java:165)
在
原因:java.lang.reflect.InvocationTargetException:null
位于sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法)
位于sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
在sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
位于java.lang.reflect.Constructor.newInstance(Constructor.java:526)
在
原因:java.lang.RuntimeException:无法创建和运行进程管理器
在org.jboss.arquillian.core.impl.ManagerImpl.(ManagerImpl.java:105)。。。。。。
原因:java.lang.IllegalArgumentException:多次尝试注册同一观察者:org.jboss.as.arquillian.container.ServerSetupObserver,请检查类路径是否存在冲突的jar版本
位于org.jboss.arquillian.core.impl.ManagerImpl$2.observer(ManagerImpl.java:354)
位于org.jboss.arquillian.core.impl.loadable.LoadableExtensionLoader$1.observer(LoadableExtensionLoader.java:101)
位于org.jboss.as.arquillian.container.CommonContainerExtension.register(CommonContainerExtension.java:41)
在org.jboss.as.arquillian.container.remote.RemoteContainerExtension.register(RemoteContainerExtension.java:33)上
pom.xml

<properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <!-- maven-compiler-plugin -->
        <maven.compiler.target>1.7</maven.compiler.target>
        <maven.compiler.source>1.7</maven.compiler.source>
        <!-- build details -->
        <timestamp>${maven.build.timestamp}</timestamp>
        <maven.build.timestamp.format>yyyy-MM-dd HH:mm:ss</maven.build.timestamp.format>
        <build_version>${project.version}</build_version>
        <build_number>00001</build_number>
        <!-- dependency version variables -->
        <struts2.version>2.3.24</struts2.version>
        <hibernate.version>4.3.9.Final</hibernate.version>
        <resteasy.version>3.0.11.Final</resteasy.version>
        <apache.common.version>3.3.2</apache.common.version>
        <junit-version>4.12</junit-version>
        <arquillian-version>1.1.8.Final</arquillian-version>
        <arquillian-transaction-version>1.0.1.Final</arquillian-transaction-version>
        <arquillian-wildfly-version>8.2.0.Final</arquillian-wildfly-version>
    </properties>
    <repositories>
        <repository>
            <id>JBoss Repository</id>
            <url>https://repository.jboss.org/nexus/content/groups/public/</url>
        </repository>
    </repositories>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.jboss.spec</groupId>
                <artifactId>jboss-javaee-7.0</artifactId>
                <version>1.0.0.Final</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <!-- -JUNIT-->
            <dependency>
               <groupId>junit</groupId>
               <artifactId>junit</artifactId>
               <version>${junit-version}</version>
            </dependency>
            <!-- Arquillian itself-->
            <dependency>
                <groupId>org.jboss.arquillian</groupId>
                <artifactId>arquillian-bom</artifactId>
                <version>${arquillian-version}</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
            <!-- this is in an extention to arquillian it is optional-->
            <dependency>
                <groupId>org.jboss.arquillian.extension</groupId>
                <artifactId>arquillian-transaction-bom</artifactId>
                <version>${arquillian-transaction-version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <!-- this is container adapter for wildfly-->
            <dependency>
               <groupId>org.wildfly</groupId>
               <artifactId>wildfly-arquillian-container-embedded</artifactId>
               <version>${arquillian-wildfly-version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>

        <!-- Test dependencies -->
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.arquillian.junit</groupId>
            <artifactId>arquillian-junit-container</artifactId>
            <version>1.1.8.Final</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.wildfly</groupId>
            <artifactId>wildfly-arquillian-container-embedded</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.arquillian.extension</groupId>
            <artifactId>arquillian-transaction-jta</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.arquillian.protocol</groupId>
            <artifactId>arquillian-protocol-servlet</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.weld</groupId>
            <artifactId>weld-core</artifactId>
            <version>1.1.5.Final</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.6.4</version>
            <scope>test</scope>
        </dependency>

        <!-- struts 2 dependencies -->
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-core</artifactId>
            <version>${struts2.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-convention-plugin</artifactId>
            <version>${struts2.version}</version>
        </dependency>
        <dependency>
           <groupId>org.apache.struts</groupId>
           <artifactId>struts2-json-plugin</artifactId>
           <version>${struts2.version}</version>
        </dependency>

        <!-- Import the CDI API -->
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-cdi-plugin</artifactId>
            <version>${struts2.version}</version>
        </dependency>
        <dependency>
            <groupId>javax.enterprise</groupId>
            <artifactId>cdi-api</artifactId>
            <version>1.2</version><!--$NO-MVN-MAN-VER$-->
        </dependency>

        <!-- Import the Common Annotations API (JSR-250) -->
        <dependency>
            <groupId>org.jboss.spec.javax.annotation</groupId>
            <artifactId>jboss-annotations-api_1.2_spec</artifactId>
        </dependency>

        <!-- Import the Servlet API -->
        <dependency>
            <groupId>org.jboss.spec.javax.servlet</groupId>
            <artifactId>jboss-servlet-api_3.1_spec</artifactId>
        </dependency>

        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>7.0</version>
        </dependency>

        <!-- Jboss weld -->
        <dependency>
            <groupId>org.jboss.weld</groupId>
            <artifactId>weld-core</artifactId>
            <version>2.2.2.Final</version>
            <scope>provided</scope>
        </dependency>

    </dependencies>
    <build>
      <finalName>fms</finalName>
            <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
                <filtering>true</filtering>
            </testResource>
        </testResources>
        <plugins>
            <plugin>
                <groupId>org.wildfly.plugins</groupId>
                <artifactId>wildfly-maven-plugin</artifactId>
                <version>1.0.0.Final</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugin</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.6</version>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.18.1</version>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <!-- An optional Arquillian testing profile that executes tests in your 
                Wildfly instance -->
            <!-- This profile will start a new Wildfly instance, and execute the 
                test, shutting it down when done -->
            <!-- Run with: mvn clean test -Parq-wildfly-managed -->
            <id>arq-wildfly-managed</id>
            <dependencies>
                <dependency>
                  <groupId>org.wildfly.arquillian</groupId>
                  <artifactId>wildfly-arquillian-container-managed</artifactId>
                  <version>1.0.0.Alpha5</version>
                  <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <!-- An optional Arquillian testing profile that executes tests in a remote 
                Wildfly instance -->
            <!-- Run with: mvn clean test -Parq-wildfly-remote -->
            <id>arq-wildfly-remote</id>
            <dependencies>
                <dependency>
                  <groupId>org.wildfly.arquillian</groupId>
                  <artifactId>wildfly-arquillian-container-remote</artifactId>
                  <version>1.0.0.Alpha5</version>
                  <scope>test</scope>
                </dependency>
            </dependencies>
            <build>
                <testResources>
                    <testResource>
                        <directory>src/test/resources</directory>
                        <filtering>true</filtering>
                    </testResource>
                </testResources>
                <plugins>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.18.1</version>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>development</id>
            <properties>
                <env>development</env>
                <fms.restws.url>http://localhost:8080/fms/rs/json</fms.restws.url>
            </properties>
        </profile>
        <profile>
            <id>prod</id>
            <properties>
                <env>prod</env>
                <fms.restws.url>http://prodserver:8080/fms/rs/json</fms.restws.url>
            </properties>
        </profile>
    </profiles>

UTF-8
1.7
1.7
${maven.build.timestamp}
yyyy MM dd HH:MM:ss
${project.version}
00001
2.3.24
4.3.9.最终版本
3.0.11.1最终版本
3.3.2
4.12
1.1.8.最终版本
1.0.1.最终版本
8.2.0.1最终版本
JBoss存储库
https://repository.jboss.org/nexus/content/groups/public/
org.jboss.spec
jboss-javaee-7.0
1.0.0.1决赛
聚甲醛
进口
朱尼特
朱尼特
${junit版本}
org.jboss.arquillian
阿奎利安bom
${arquillian版本}
进口
聚甲醛
org.jboss.arquillian.extension
阿奎利安事务bom
${arquillian事务版本}
聚甲醛
进口
野生蝇
wildfly arquillian嵌入式容器
${arquillian wildfly版本}
log4j
log4j
1.2.17
朱尼特
朱尼特
测试
org.jboss.arquillian.junit
arquillian junit容器
1.1.8.最终版本
测试
野生蝇
wildfly arquillian嵌入式容器
测试
org.jboss.arquillian.extension
阿奎利安事务jta
测试
org.jboss.arquillian.protocol
arquillian协议servlet
测试
org.jboss.weld
焊芯
1.1.5.最终版本
测试
org.slf4j
slf4j简单
1.6.4
测试
org.apache.struts
struts2型芯
${struts2.version}
org.apache.struts
struts2约定插件
${struts2.version}
org.apache.struts
struts2 json插件
${struts2.version}
org.apache.struts
struts2 cdi插件
${struts2.version}
javax.enterprise
CDIAPI
1.2
org.jboss.spec.javax.annotation
jboss-annotations-api_1.2_规范
org.jboss.spec.javax.servlet
jboss-servlet-api_3.1_规范
爪哇
JavaEEAPI
7
org.jboss.weld
焊芯
2.2.2.最终版本
假如
柔性制造系统
src/main/resources
真的
src/测试/资源
真的
org.wildfly.plugins
wildfly maven插件
1.0.0.1决赛
org.apache.maven.plugin
maven资源插件
2.6
maven surefire插件
2.18.1
野蝇管理
org.wildfly.arquillian
wildfly arquillian容器管理
@RunWith(Arquillian.class) public class GreeterTest {

@Inject
Greeter greeter;

@Deployment
public static Archive<?> createDeployment() {
    return ShrinkWrap.create(WebArchive.class, "fms-tes.war")
            .addClass(Greeter.class)
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
}

@Test
public void should_create_greeting() throws Exception {
    Assert.assertEquals("Hello, Earthling!",greeter.createGreeting("Earthling"));
    greeter.greet(System.out, "Earthling");
} }