0 Replies Latest reply on Oct 7, 2017 12:16 PM by avermeerbergen

    Arquilian Getting Started fails with java.lang.NoClassDefFoundError: org/junit/rules/RunRules error

    avermeerbergen

      Hello,

       

      I'm a newbie with Arquilian, and I found a small mistake in the Getting Started, so I hope I can repay Arquilian team for their great work with this small feedback (I googled to make sure nobody reported this issue before I did).

       

      Here's the issue: I started with the "Getting started" article (at Getting Started · Arquillian Guides ) , using "Generate a project from a Maven archetype" option at the beginning.

      I followed every step, but when I reached the "Run the Arquillian Test" step, the Junit test failed with this error:

       

      java.lang.NoClassDefFoundError: org/junit/rules/RunRules

      at org.jboss.arquillian.junit.RulesEnricher.enrichStatement(RulesEnricher.java:76)

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

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

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

      ... etc...

       

      It turns out that the missing org.junit.rules.RunRules class was introduced in Junit 4.9 (see http://junit.org/junit4/javadoc/4.12/org/junit/rules/RunRules.html)

      But the instructions in the page lead to a pom.xml with the following version of JUnit:

       

      <dependency>

      <groupId>junit</groupId>

      <artifactId>junit</artifactId>

      <version>4.8.1</version>

      <scope>test</scope>

      </dependency>

       

      Indeed, the getting started page mentions JUnit 4.8 at several places:

      * You’ll notice the project is configured to use Java 1.6 and JUnit 4.8, the minimum recommended versions of Java and JUnit for using Arquillian, respectively.

      * If you’re having trouble with the pom.xml up to this point, you can download the file pom-no-container-profiles.xml from the example project and rename it to pom.xml.

      => the pom-no-container-profiles.xml file also contains a reference to JUnit 4.8.

       

      What's strange is that in other places of the getting started there are samples showing JUnit dependency with version 4.12, but nowhere when using the Maven archtype there is a clear sentence telling to change JUnit version from 4.8 to 4.12.

       

      Of course I finally edited pom.xml and changed JUnit version to 4.12, which solves the issue with the JUnit test (all green )

       

      I think it's a small mistake (spread at different locations) and fixing it could make newbies' first experience with Arquilian better if it could be fixed.

       

      Hope it helps,

       

      Alexandre Vermeerbergen