Version 1

    Here are some tips for troubleshooting Arquillian, mostly for Maven / JUnit usage with the JBoss AS container.

     

    Tests run, Arquillian doesn't start, NPE on @EJB / @Inject values

     

    This usually means the tests are not integrated with Arquillian.  Arquillian will not start if the test doesn't specify it.   In turn, the container won't start.

    • For JUnit tests, add @RunWith(Arquillian.class)
    • For TestNG tests, extend org.jboss.arquillian.testng.Arquillian
    • Make the Maven Project has dependencies / surefire configuration for either JUnit or TestNG, not both.  Surefire will either not run the tests at all, or it won't start Arquillian.
      • Only one test container integration dependency.   e.g. org.jboss.arquillian.junit:arquillian-junit-containeror  org.jboss.arquillian.testng:arquillian-testng-container.   Never both!
      • Similarly, ensure that only one of the test frameworks is a dependency.

    Null @EJB values

     

    If @EJB fields are null:

    1. Make sure Arquillian is actually starting the container.
    2. EJB3.1 'interface-less' EJBs are not injected (by Arquillian v1.1.2 at least).   Add local interfaces and it will work.