13 Replies Latest reply on Apr 25, 2012 8:32 AM by zebut

    @RunWith(Arquillian.class) fail




      I'm trying to run tests with arquillian but without success.

      I have an exception when tests run :


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

      I've seen these topics on the forum but my problem has not been resolved.


      I need your help,


      Here is my pom.xml :



      <?xml version="1.0" encoding="UTF-8"?>

      <project xmlns="http://maven.apache.org/POM/4.0.0"












          <!-- =========================================================== -->

          <!--     Module Description                                                                                       -->

          <!-- =========================================================== -->




          <name>arquilliam tests</name>

          <description>Test threecomponent component using arquilliam.</description>



























































      Here the exception :



      Test set: org.mapfaces.test.PersonTest


      Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.379 sec <<< FAILURE!

      org.monGroupId.test.PersonTest  Time elapsed: 0.379 sec  <<< ERROR!

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

                at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:170)

                at org.jboss.arquillian.test.spi.TestRunnerAdaptorBuilder.build(TestRunnerAdaptorBuilder.java:52)

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

                at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:236)

                at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:134)

                at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:113)

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

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                at java.lang.reflect.Method.invoke(Method.java:597)

                at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)

                at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)

                at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)

                at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:103)

                at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:74)

      Caused by: java.lang.reflect.InvocationTargetException

                at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

                at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

                at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

                at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

                at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:166)

                ... 14 more






      A simple class to test :


      public class Person {

          private String name;


          public Person(String name) {

              this.name = name;



          public String getName() {

              return name;



          public void setName(String name) {

              this.name = name;







      And the tests:


      import javax.inject.Inject;

      import junit.framework.Assert;

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

      import org.jboss.arquillian.junit.Arquillian;

      import org.jboss.shrinkwrap.api.ShrinkWrap;

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

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

      import org.junit.Test;

      import org.junit.runner.RunWith;



      * Class test

      * Not implemented yet



      public class PersonTest {



          public static JavaArchive createDeployment() {

              return ShrinkWrap.create(JavaArchive.class)


                  .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");




          Person greeter;



          public void getName() {


              String result = "test";

              greeter = new Person(result);

              Assert.assertEquals(result, greeter.getName());




      Thank you in advance!

        • 1. Re: @RunWith(Arquillian.class) fail

          Your project POM doesnt seem to contain a dependency for a container adapter. You'll need to choose one of the supported container adapters in Arquillian, for the archive to be deployed to.


          You can refer to this page in the reference guide for the Maven artifact Id of a container adapter that you wish to use.

          • 2. Re: @RunWith(Arquillian.class) fail

            try to add









            to your pom if working with jboss-as! should work.

            • 3. Re: @RunWith(Arquillian.class) fail

              Thanks for your answers,


              I try to add container to my pom.xml (adding the following code below </dependencies> tag)






















              I have the same problems :

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


              but now I have warnings :


              log4j:WARN No appenders could be found for logger (org.jboss.logging).

              log4j:WARN Please initialize the log4j system properly.

              Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.279 sec <<< FAILURE!

              • 4. Re: @RunWith(Arquillian.class) fail

                Have you declared the system variable JBOSS_HOME? You should either declare this environment variable to point to the installation directory of your AS like D:\programs\jbossAS7.1.2.SNAPSHOT or create an arquillian.xml within the src/test/resources folder with the content:


                <arquillian xmlns="http://jboss.org/schema/arquillian"
                <container qualifier="jbossas-7-managed" default="true">
                <property name="jbossHome">directory of jboss-as installation</property>


                The warnings can safely be ignored, at least while standard formatting of log output is good enough.


                If it still doesn't work, You may try to follow the guide:



                This gives you quickly a running example which allows you to isolate your problem by comparision.

                • 5. Re: @RunWith(Arquillian.class) fail

                  I have to install JBOSS-AS on my computer ?

                  Do I not have it with maven dependencies?

                  • 6. Re: @RunWith(Arquillian.class) fail

                    For the managed version yes, you must install it on your computer!

                    As far as I know even the embedded version is making referencies to the AS directory. I'm not sure what all is included in the maven dependencies w.r.t the embedded testing.

                    Until now I never used the embedded version, because it referencies AS6 which I don't have installed. Maybe I must try once to see what is happening.

                    1 of 1 people found this helpful
                    • 7. Re: @RunWith(Arquillian.class) fail

                      Okay, thank you for your answers.

                      I thought use Arquillian without installing anything on the computer.

                      • 8. Re: @RunWith(Arquillian.class) fail

                        You can have Maven install it for you, by using the maven-dependency-plugin



                        1 of 1 people found this helpful
                        • 9. Re: @RunWith(Arquillian.class) fail

                          I tried to add your pom.xml.


                          My problem does not seem to come from dependency :

                          I have the same error that at the beginning : Could not create a new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor


                          Do you have other ideas of where my problem may come from ?


                          I followed the toturial 'getting started' with you pom.xml from my last test.


                          I use

                          Apache Maven 3.0.4

                          Java version: 1.6.0_30, vendor: Sun Microsystems Inc.

                          Java home: /usr/lib/jvm/jdk1.6.0_30/jre

                          OS name: "linux", version: "3.0.0-17-generic", arch: "amd64", family: "unix"


                          thanks by advance

                          • 10. Re: @RunWith(Arquillian.class) fail

                            You don't have the cause for the cause of the exception? The real cause seems to be missing from your stacktrace. Normally when it fails at that point, it's missing 'something' on classpath.


                            One option is that something has been downloaded wrong, maybe try cleaning org.jboss.arquillian.* in your local maven repository.

                            • 11. Re: @RunWith(Arquillian.class) fail

                              I was indeed a conflict between an old version of Arquillian and one I use now.

                              I had a parent project to maven who had old dependencies of Arquillian.


                              I did not have access to this project.

                              Not easy to find the problem .


                              Now I have

                              org.jboss.arquillian.container.spi.ConfigurationException: jbossHome 'null' must exist


                              It is normal with a remote version ?


                              Thank for your help.

                              • 12. Re: @RunWith(Arquillian.class) fail

                                You're using the jboss-as-managed contianer and not the jboss-as-remote container. The difference is the managed require jbossHome set in arquillian.xml to know how to start it. But if you start it your self outside the test and use the remote container, you don't need jbossHome.







                                • 13. Re: @RunWith(Arquillian.class) fail

                                  It work perfectly.

                                  Thank you