2 Replies Latest reply on Mar 4, 2015 9:22 AM by Johan van Kampen

    Arquillian jacoco extension throws NullpointerException when using 'createFromZipFile'

    Johan van Kampen Newbie

      My goal is to use arquillian for integration testing. The way I wanted to attack this was building the ear-file and deploy the builded ear on WildFly 8.2.0.Final (using wildfly-arquillian-container-remote).

      My project is a multi-module maken project :

      - dri (parent)

      -- dri.ejb (remote ejb's with business- and database logic)

      -- dri.ear (packaging of the dri.ejb jar for deployment op WildFly 8.2.0)

      -- dri.test (integration test functionality)

       

      The dependencies used in the pom (of the test-module) are like:

      <dependency>

        <groupId>org</groupId>

        <artifactId>postgresql</artifactId>

        <version>9.2-1003.jdbc4</version>

        <scope>test</scope>

      </dependency>

      <dependency>

        <groupId>org.dbunit</groupId>

        <artifactId>dbunit</artifactId>

        <version>2.4.9</version>

        <scope>test</scope>

      </dependency>

      <dependency>

        <groupId>junit</groupId>

        <artifactId>junit</artifactId>

        <version>4.11</version>

        <scope>test</scope>

      </dependency>

       

      <dependency>

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

        <artifactId>arquillian-bom</artifactId>

        <version>1.1.5.Final</version>

        <type>pom</type>

        <scope>import</scope>

      </dependency>

      <dependency>

        <groupId>org.wildfly</groupId>

        <artifactId>wildfly-arquillian-container-remote</artifactId>

        <version>8.2.0.Final</version>

        <scope>test</scope>

      </dependency>

      <dependency>

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

        <artifactId>arquillian-junit-container</artifactId>

        <scope>test</scope>

      </dependency>

      <dependency>

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

        <artifactId>arquillian-protocol-servlet</artifactId>

        <scope>test</scope>

      </dependency>

      <dependency>

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

        <artifactId>arquillian-jacoco</artifactId>

        <version>1.0.0.Alpha7</version>

        <scope>test</scope>

      </dependency>

      <dependency>

        <groupId>org.jacoco</groupId>

        <artifactId>org.jacoco.core</artifactId>

        <version>0.7.0.201403182114</version>

        <scope>test</scope>

      </dependency>

      <dependency>

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

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

        <scope>test</scope>

      </dependency>

       

      I use the code below which results in a NullpointerException :

      @Deployment
      public static EnterpriseArchive createEARArchive() {

       

        EnterpriseArchive ear = ShrinkWrap.createFromZipFile(EnterpriseArchive.class, new File("../dri.ear/target/dri.ear-1.0-SNAPSHOT.ear"));

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

         return  ear;

       

      }

       

      Full stacktrace

      java.lang.NullPointerException: null

        at org.jboss.arquillian.extension.jacoco.client.ApplicationArchiveInstrumenter.processArchive(ApplicationArchiveInstrumenter.java:52)

        at org.jboss.arquillian.extension.jacoco.client.ApplicationArchiveInstrumenter.processArchive(ApplicationArchiveInstrumenter.java:68)

        at org.jboss.arquillian.extension.jacoco.client.ApplicationArchiveInstrumenter.process(ApplicationArchiveInstrumenter.java:74)

        at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.applyApplicationProcessors(DeploymentGenerator.java:223)

        at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.buildTestableDeployments(DeploymentGenerator.java:172)

        at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.createTestableDeployments(DeploymentGenerator.java:148)

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

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

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

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

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

        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:145)

        at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116)

        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(NativeMethodAccessorImpl.java:57)

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

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

        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:84)

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

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

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

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

        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:65)

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

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

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

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

        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:145)

        at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116)

        at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.beforeClass(EventTestRunnerAdaptor.java:80)

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

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

        at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:49)

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

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

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

        at org.junit.runners.Suite.runChild(Suite.java:127)

        at org.junit.runners.Suite.runChild(Suite.java:26)

        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)

        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)

        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)

        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)

        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)

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

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

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

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

        at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)

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

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

       

       

      Using the configuration below, everything works fine. However, this is a relative simple application. I have several much more complex applications for which I would prefer the first configuration.  :

      @Deployment
      public static Archive<?> createTestArchive() {

       

        File[] libs = Maven.resolver()

        .loadPomFromFile("pom.xml").resolve("omnimap:services","h2:utils")

        .withTransitivity().as(File.class);

       

        WebArchive war =

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

        .addPackage(DossierRelatieIndexService.class.getPackage())

        .addPackage(Dossier.class.getPackage())

        .addPackage(Constanten.class.getPackage())

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

       

        war.addAsLibrary(new File("../dri.ejb/target/dri.ejb-1.0-SNAPSHOT.jar"));

        war.addAsLibraries(libs).as(JavaArchive.class);

       

         return war;

      }

       

      What am I doing wrong?