6 Replies Latest reply on Apr 17, 2013 3:10 PM by Bartosz Majsak

    set up arquillian for seam 2 apps, Could not create a new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor error

    Emy Hoffner Newbie

      Hi,

      i'm newbie to arquillian and tried for week to set up arquillian with seam 2 application, jboss 5.1

      can you please tell me which dependencies and stable version of them should i use, because i try after the getting started and extension for seam 2, but get this error:

      Could not create a new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor

       

      thanks in advance

      Emy

        • 1. Re: set up arquillian for seam 2 apps, Could not create a new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor error
          Bartosz Majsak Master

          Hi Emy,

           

          can you give me a bit more details about your setup? Namely how you configure Arquillian (pom.xml, arquillian.xml), what is your environment and how does the test look like?

           

          Have you already seen confluence documentation?

           

          Cheers,

          Bartosz

          • 2. Re: set up arquillian for seam 2 apps, Could not create a new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor error
            Emy Hoffner Newbie

            Hi Bartosz,

             

            Updated, i try your example in my seam 2 Apps and add this dependencies in the pom:

             

            <properties>

                    <!-- Versioning -->

                    <version.arquillian_core>1.0.0.CR7</version.arquillian_core>

                    <version.fest.assert>1.4</version.fest.assert>

                    <version.shrinkwrap.descriptors>1.0.0-beta-5</version.shrinkwrap.descriptors>

                    <version.seam>2.2.2.Final</version.seam>

                   <version.arquillian.seam2>1.0.0.Alpha2</version.arquillian.seam2>

             

                </properties>

             

             

            <dependencyManagement>

                    <dependencies>

                        <dependency>

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

                            <artifactId>arquillian-bom</artifactId>

                            <version>${version.arquillian_core}</version>

                            <type>pom</type>

                            <scope>import</scope>

                        </dependency>

                        <dependency>

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

                            <artifactId>arquillian-build</artifactId>

                            <version>${version.arquillian_core}</version>

                            <type>pom</type>

                            <scope>import</scope>

                        </dependency>

                        <dependency>

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

                            <artifactId>arquillian-core-impl-base</artifactId>

                            <classifier>tests</classifier>

                            <version>${version.arquillian_core}</version>

                        </dependency>

                        <dependency>

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

                            <artifactId>arquillian-test-impl-base</artifactId>

                            <classifier>tests</classifier>

                            <version>${version.arquillian_core}</version>

                        </dependency>

                    </dependencies>

                </dependencyManagement>

             

                <dependencies>

             

                    <!-- arquillian -->

                    <dependency>

                        <groupId>org.jboss.seam</groupId>

                        <artifactId>jboss-seam</artifactId>

                        <version>${version.seam}</version>

                        <scope>provided</scope>

                    </dependency>

                    <dependency>

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

                        <artifactId>arquillian-core-spi</artifactId>

                    </dependency>

                    <dependency>

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

                        <artifactId>arquillian-test-spi</artifactId>

                    </dependency>

                    <dependency>

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

                        <artifactId>arquillian-container-test-spi</artifactId>

                    </dependency>

                    <dependency>

                        <groupId>org.jboss.shrinkwrap.resolver</groupId>

                        <artifactId>shrinkwrap-resolver-api-maven</artifactId>

                    </dependency>

                    <dependency>

                        <groupId>org.jboss.shrinkwrap.resolver</groupId>

                        <artifactId>shrinkwrap-resolver-impl-maven</artifactId>

                    </dependency>

                    <dependency>

                        <groupId>org.jboss.shrinkwrap</groupId>

                        <artifactId>shrinkwrap-impl-base</artifactId>

                    </dependency>

                    <dependency>

                        <groupId>org.jboss.shrinkwrap</groupId>

                        <artifactId>shrinkwrap-extension-descriptors</artifactId>

                        <version>${version.shrinkwrap.descriptors}</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>

                        <scope>test</scope>

                    </dependency>

                    <dependency>

                        <groupId>org.easytesting</groupId>

                        <artifactId>fest-assert</artifactId>

                        <version>${version.fest.assert}</version>

                        <scope>test</scope>

                    </dependency>

                    <dependency>

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

                        <artifactId>arquillian-seam2</artifactId>

                        <version>${version.arquillian.seam2}</version>

                        <scope>test</scope>

                    </dependency>

            </dependencies>

             

            And i added the extension dependencies like your document in the arquillian:

             

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

                <engine>

                    <property name="deploymentExportPath">target</property>

                </engine>

             

               <container qualifier="jbossas51">

                    <configuration>

                        <property name="javaHome">C:/pathtoJava/jdk1.6.0_27</property>

                        <property name="jbossHome">C:/pathtoJboss</property>

                    </configuration>

                </container>

            </arquillian>

             

             

            but it says:

            ComponentInjectionTestCase: Could not invoke deployment method: public static org.jboss.shrinkwrap.api.Archive com.zanox.ui.productincentivefinder.service.impl.ComponentInjectionTestCase.createDeployment()

             

             

            how can i solve this problem?

            Thanks

            • 3. Re: set up arquillian for seam 2 apps, Could not create a new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor error
              Bartosz Majsak Master

              Can you share full stack trace so I can see the root cause of the deployment method exception?

              Maybe also test class?

              • 5. Re: set up arquillian for seam 2 apps, Could not create a new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor error
                Emy Hoffner Newbie

                Hi Martosz,

                 

                the test class is the same as in the site:

                 

                import org.jboss.arquillian.container.test.api.Deployment;

                import org.jboss.arquillian.junit.Arquillian;

                import org.jboss.seam.annotations.In;

                import org.jboss.shrinkwrap.api.Archive;

                import org.jboss.shrinkwrap.api.ShrinkWrap;

                import org.jboss.shrinkwrap.api.asset.EmptyAsset;

                import org.jboss.shrinkwrap.api.spec.WebArchive;

                import org.junit.Assert;

                import org.junit.Test;

                import org.junit.runner.RunWith;

                 

                import  javaResource.FluidOuncesConverter;

                 

                 

                @RunWith(Arquillian.class)

                public class ComponentInjectionTestCase

                {

                   @Deployment

                   public static Archive<?> createDeployment()

                   {

                      return ShrinkWrap.create(WebArchive.class, "test.war")

                                       .addClass(FluidOuncesConverter.class)

                                       .addPackages(true, "org.fest")

                                       .addAsResource(EmptyAsset.INSTANCE, "seam.properties")

                                       .setWebXML("web.xml");

                   }

                 

                   @In

                   FluidOuncesConverter fluidOuncesConverter;

                 

                   @Test

                   public void shouldInjectSeamComponent() throws Exception

                   {

                       Assert.assertNotNull(fluidOuncesConverter);

                   }

                 

                   @Test

                   public void shouldConvertFluidOuncesToMillilitres() throws Exception

                   {

                      // given

                      Double ouncesToConver = Double.valueOf(8.0d);

                      Double expectedMillilitres = Double.valueOf(236.5882368d);

                 

                      // when

                      Double millilitres = fluidOuncesConverter.convertToMillilitres(ouncesToConver);

                 

                      // then

                      Assert.assertEquals(millilitres, expectedMillilitres);

                 

                   }

                }

                 

                 

                And the tested class:

                import org.jboss.seam.annotations.Name;

                 

                @Name("fluidOuncesConverter")

                public class FluidOuncesConverter

                {

                 

                   public Double convertToMillilitres(Double ounces)

                   {

                      return ounces * 29.5735296;

                   }

                 

                }

                 

                I've used Arquillian Core 1.0.3.Final, but the same error. The stack trace are:

                 

                java.lang.RuntimeException: Could not invoke deployment method: public static org.jboss.shrinkwrap.api.Archive

                  com.packageJava.ComponentInjectionTestCase.createDeployment()

                    at org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.invoke(AnnotationDeploymentScenarioGenerator.java:160)

                    at org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.generateDeployment(AnnotationDeploymentScenarioGenerator.java:94)

                    at org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.generate(AnnotationDeploymentScenarioGenerator.java:57)

                    at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.generateDeployment(DeploymentGenerator.java:79)

                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

                    at java.lang.reflect.Method.invoke(Unknown Source)

                    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.EventImpl.fire(EventImpl.java:67)

                    at org.jboss.arquillian.container.test.impl.client.ContainerEventController.execute(ContainerEventController.java:100)

                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

                    at java.lang.reflect.Method.invoke(Unknown Source)

                    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.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:75)

                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

                    at java.lang.reflect.Method.invoke(Unknown Source)

                    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

                    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

                    at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:60)

                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

                    at java.lang.reflect.Method.invoke(Unknown Source)

                    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

                    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

                    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.test.impl.EventTestRunnerAdaptor.beforeClass(EventTestRunnerAdaptor.java:80)

                    at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:182)

                    at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314)

                    at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)

                    at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:199)

                    at org.junit.runners.ParentRunner.run(ParentRunner.java:300)

                    at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:147)

                    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.NativeMethodAccessorImpl.invoke0(Native Method)

                    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

                    at java.lang.reflect.Method.invoke(Unknown Source)

                    at org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.invoke(AnnotationDeploymentScenarioGenerator.java:156)

                    ... 50 more

                Caused by: java.lang.IllegalArgumentException: web.xml not found in classloader sun.misc.Launcher$AppClassLoader@6f978b94

                    at org.jboss.shrinkwrap.api.asset.ClassLoaderAsset.<init>(ClassLoaderAsset.java:70)

                    at org.jboss.shrinkwrap.api.asset.ClassLoaderAsset.<init>(ClassLoaderAsset.java:45)

                    at org.jboss.shrinkwrap.impl.base.container.WebContainerBase.setWebXML(WebContainerBase.java:94)

                    at com.ComponentInjectionTestCase.createDeployment(ComponentInjectionTestCase.java:27)

                    ... 55 more

                • 6. Re: set up arquillian for seam 2 apps, Could not create a new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor error
                  Bartosz Majsak Master

                  Isn't it a problem?

                   

                  Caused by: java.lang.IllegalArgumentException: web.xml not found in classloader sun.misc.Launcher$AppClassLoader@6f978b94

                      at org.jboss.shrinkwrap.api.asset.ClassLoaderAsset.<init>(ClassLoaderAsset.java:70)

                      at org.jboss.shrinkwrap.api.asset.ClassLoaderAsset.<init>(ClassLoaderAsset.java:45)

                      at org.jboss.shrinkwrap.impl.base.container.WebContainerBase.setWebXML(WebContainerBase.java:94)

                      at com.ComponentInjectionTestCase.createDeployment(ComponentInjectionTestCase.java:27)

                   

                  Please update arquillian core to the latest version and adjust your shrinkwrap code.