8 Replies Latest reply on Jun 12, 2012 4:24 AM by Gerhard Poul

    ClassNotFoundException for test class in EAR-packaged test: test class not included in test.war?

    Robin Macharg Newbie

      Hello again,


      Following my last post (https://community.jboss.org/thread/200319?tstart=0) I've managed to create a ShrinkWrapped EAR containing the EJBs I want to test (as .jar files). In my test class I have a single CDI @Inject annotation, and a single @Test annotated test (it does an Assert.fail().  I'd LOVE to see a failure, or indeed anything!) I'm saving the archive contents for analysis via a 'deploymentExportPath' arquillian.xml <engine> property.  I'm targeting a managed JBoss AS7.1.1.FINAL install.


      The EAR deploys successfully.


      I'm seeing a ClassNotFoundException for my ComponentTest class.  Looking at the generated EAR artifact I can see that it has all the dependency JARs included, as well as a test.war file.  application.xml has also been updated appropriately. The test.war only contains /WEB-INF/lib/arquillian-protocol.jar.  I can't see my test class anywhere.  If I run under debug with suspend=y I can see the compiled test class in my target directory.


      I've followed the FAQ advice regarding archive naming (https://community.jboss.org/wiki/WhenIRunMyArquillianTestIGetAClassNotFoundExceptionForTheUnitTestClassItsSelfHowIsThatPossible : I leave it up to ShrinkWrap), and I've also followed advice about using <defaultProtocol type="Servlet 3.0"/> in my arquillian.xml along with the appropriate maven dependency (here: https://community.jboss.org/message/622637 and https://issues.jboss.org/browse/AS7-1696).  (BTW Is this still correct advice?)


      Is my test class supposed to be packaged inside the test.war and deployed to the server?  Or elsewhere inside the EAR file?  Or do I have to add some config to cause it to be found and included?  It resides in the normal src/test/java location.  I thought Arquillian managed that for me.  Does it remain solely on the client side, or is it passed across to the server somehow?  How does the server-side arquillian stuff know the test class name in the first place (in order that it can't find it)?


      What is test.war supposed to contain?  Perhaps someone could provide a directory listing?  I'd love to understand the sequence of events going on under the bonnet during a test.


      I'm happy to post specific config if requested, and can hop onto IRC if that would help.