3 Replies Latest reply on Mar 21, 2013 4:39 AM by Bartosz Majsak

    Errors with Junit tests in JBoss - Arquillian set up problems

    J k Newbie

      Hi

       

      I am having some problems with Aquillian set up in JBoss. When I try to run JUnit test i get the the errors below. The thing is I am able to run tests on another JBoss quickstart so I assume the problem must lie in my POM??

       

      (There is a snapshot of the POM below log files)

       

      Any help would be grately appreciated ..thanks

       

      java.lang.RuntimeException: Could not create new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor

                at org.jboss.arquillian.test.spi.SecurityNewActions.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 jboss

                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:68)

                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

       

      --------------------------------------------------------------------------------------------------------------------------------

       

      <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>

                <parent>

                          <artifactId>mast</artifactId>

                          <groupId>com.holiday</groupId>

                          <version>1.0 -SNAPSHOT</version>

                          <relativePath>..</relativePath>

                </parent>

                <artifactId>webapp</artifactId>

                <packaging>war</packaging>

       

       

       

       

       

       

                <properties>

                          <version.jboss.bom>1.0.4.Final</version.jboss.bom>

                          <version.surefire.plugin>2.10</version.surefire.plugin>

                </properties>

       

       

                <dependencyManagement>

                          <dependencies>

                                    <!-- JBoss distributes a complete set of Java EE 6 APIs including a Bill

                                              of Materials (BOM). A BOM specifies the versions of a "stack" (or a collection)

                                              of artifacts. We use this here so that we always get the correct versions

                                              of artifacts. Here we use the jboss-javaee-6.0 stack (you can read this as

                                              the JBoss stack of the Java EE 6 APIs) -->

                                    <!--This BOM builds on the Java EE full profile BOM, adding Arquillian

                                              to the mix. It also provides a version of JUnit and TestNG recommended for

                                              use with Arquillian. see https://github.com/jboss/jboss-bom/tree/master/jboss-javaee-6.0-with-tools -->

                                    <dependency>

                                              <groupId>org.jboss.bom</groupId>

                                              <artifactId>jboss-javaee-6.0-with-tools</artifactId>

                                              <version>${version.jboss.bom}</version>

                                              <type>pom</type>

                                              <scope>import</scope>

                                    </dependency>

                          </dependencies>

                </dependencyManagement>

       

       

                <dependencies>

       

       

                          <!-- Import the CDI API, we use provided scope as the API is included in

                                    JBoss AS 7 -->

                          <dependency>

                                    <groupId>javax.enterprise</groupId>

                                    <artifactId>cdi-api</artifactId>

                                    <scope>provided</scope>

                          </dependency>

       

       

                          <!-- Import the Common Annotations API (JSR-250), we use provided scope

                                    as the API is included in JBoss AS 7 -->

                          <dependency>

                                    <groupId>org.jboss.spec.javax.annotation</groupId>

                                    <artifactId>jboss-annotations-api_1.1_spec</artifactId>

                                    <scope>provided</scope>

                          </dependency>

       

       

                          <!-- Import the JAX-RS API, we use provided scope as the API is included

                                    in JBoss AS 7. -->

                          <dependency>

                                    <groupId>org.jboss.spec.javax.ws.rs</groupId>

                                    <artifactId>jboss-jaxrs-api_1.1_spec</artifactId>

                                    <scope>provided</scope>

                          </dependency>

       

       

                          <dependency>

                                    <groupId>org.hibernate.javax.persistence</groupId>

                                    <artifactId>hibernate-jpa-2.0-api</artifactId>

                                    <version>1.0.0.Final</version><!--$NO-MVN-MAN-VER$ -->

                          </dependency>

       

       

                          <dependency>

                                    <groupId>javax.ejb</groupId>

                                    <artifactId>ejb-api</artifactId>

                                    <version>3.0</version>

                          </dependency>

       

       

                          <dependency>

                                    <groupId>commons-io</groupId>

                                    <artifactId>commons-io</artifactId>

                                    <version>2.4</version>

                          </dependency>

       

       

       

       

                          <dependency>

                                    <groupId>org.apache.poi</groupId>

                                    <artifactId>poi</artifactId>

                                    <version>3.5-beta5</version>

                          </dependency>

       

       

                          <dependency>

                                    <groupId>junit</groupId>

                                    <artifactId>junit</artifactId>

                                    <scope>test</scope>

                          </dependency>

       

       

                          <dependency>

                                    <groupId>org.jboss.arquillian.junit</groupId>

                                    <artifactId>arquillian-junit-container</artifactId>

                                    <scope>test</scope>

                          </dependency>

       

       

                          <dependency>

                                    <groupId>org.jboss.arquillian.protocol</groupId>

                                    <artifactId>arquillian-protocol-servlet</artifactId>

                                    <scope>test</scope>

                          </dependency>

                          </dependencies>

                <build>

                          <!-- Maven will append the version to the finalName (which is the name

                                    given to the generated war, and hence the context root) -->

                          <finalName>${project.artifactId}</finalName>

                          <plugins>

                                    <!-- Compiler plugin enforces Java 1.6 compatibility and activates annotation

                                              processors -->

                                    <plugin>

                                              <artifactId>maven-compiler-plugin</artifactId>

                                              <version>2.3.2</version>

                                              <configuration>

                                                        <source>1.7</source>

                                                        <target>1.7</target>

                                              </configuration>

                                    </plugin>

                                    <plugin>

                                              <artifactId>maven-war-plugin</artifactId>

                                              <version>2.2</version>

                                              <configuration>

                                                        <!-- Java EE 6 doesn't require web.xml, Maven needs to catch up! -->

                                                        <failOnMissingWebXml>false</failOnMissingWebXml>

                                              </configuration>

                                    </plugin>

                                    <!-- The Maven Surefire plugin tests your application. Here we ensure

                                              we are using a version compatible with Arquillian -->

                                    <plugin>

                                              <artifactId>maven-surefire-plugin</artifactId>

                                              <version>${version.surefire.plugin}</version>

                                    </plugin>

                                    <!-- The JBoss AS plugin deploys your war to a local JBoss AS container -->

                                    <!-- To use, run: mvn package jboss-as:deploy -->

                                    <plugin>

                                              <groupId>org.jboss.as.plugins</groupId>

                                              <artifactId>jboss-as-maven-plugin</artifactId>

                                              <version>7.1.1.Final</version>

                                    </plugin>

                          </plugins>

                </build>

       

                <profiles>

                          <profile>

                                    <!-- An optional Arquillian testing profile that executes tests in a remote

                                              JBoss AS instance -->

                                    <!-- Run with: mvn clean test -Parq-jbossas-remote -->

                                    <id>arq-jbossas-remote</id>

                                    <dependencies>

                                              <dependency>

                                                        <groupId>org.jboss.as</groupId>

                                                        <artifactId>jboss-as-arquillian-container-remote</artifactId>

                                                        <version>7.1.1.Final</version>

                                                        <scope>test</scope>

                                              </dependency>

                                    </dependencies>

                          </profile>

                </profiles>

      </project>