0 Replies Latest reply on Nov 15, 2013 5:01 AM by Francesco Bulleri

    Arquillian test war packaging problem (from pom.xml) on WildFly

    Francesco Bulleri Newbie

      Hi everyone,

       

      I'm migrating from JBossAS to WildFly all my regression tests, and I encountered a blocking issue: inside the @Deployment method, my tests were creating an File[] array from the runtime dependencies of my project's pom.xml, to be passed to the ShrinkWrap war archiver:

       

      • File[] libs = Maven.resolver().loadPomFromFile("pom.xml").importRuntimeDependencies().resolve().withTransitivity().as(File.class);

       

      The problem is that in WildFly, for some reason, when I launch the tests I got this exception:

       

       

      java.lang.RuntimeException: Could not invoke deployment method: public static org.jboss.shrinkwrap.api.Archive it.cnr.ilc.omega.DeepCopyTest.createDeployment() throws java.lang.Exception

        at org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.invoke(AnnotationDeploymentScenarioGenerator.java:177)

        at org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.generateDeployment(AnnotationDeploymentScenarioGenerator.java:99)

        at org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.generate(AnnotationDeploymentScenarioGenerator.java:62)

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

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

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

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

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

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

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

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

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

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

        at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)

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

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

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

        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)

        at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)

        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)

        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)

        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

      Caused by: java.lang.reflect.InvocationTargetException

        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.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.invoke(AnnotationDeploymentScenarioGenerator.java:173)

        ... 50 more

      Caused by: java.lang.RuntimeException: Could not create object from user view

        at org.jboss.shrinkwrap.resolver.api.ResolverSystemFactory.createFromUserView(ResolverSystemFactory.java:95)

        at org.jboss.shrinkwrap.resolver.api.ResolverSystemFactory.createFromUserView(ResolverSystemFactory.java:54)

        at org.jboss.shrinkwrap.resolver.api.Resolvers.use(Resolvers.java:67)

        at org.jboss.shrinkwrap.resolver.api.maven.Maven.resolver(Maven.java:37)

        at it.cnr.ilc.omega.DeepCopyTest.createDeployment(DeepCopyTest.java:69)

        ... 55 more

      Caused by: java.lang.reflect.InvocationTargetException

        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.shrinkwrap.resolver.api.ResolverSystemFactory.createFromUserView(ResolverSystemFactory.java:91)

        ... 59 more

      Caused by: java.lang.RuntimeException: Could not create new service instance

        at org.jboss.shrinkwrap.resolver.spi.loader.SpiServiceLoader.createInstance(SpiServiceLoader.java:240)

        at org.jboss.shrinkwrap.resolver.spi.loader.SpiServiceLoader.createInstances(SpiServiceLoader.java:200)

        at org.jboss.shrinkwrap.resolver.spi.loader.SpiServiceLoader.all(SpiServiceLoader.java:79)

        at org.jboss.shrinkwrap.resolver.spi.loader.SpiServiceLoader.onlyOne(SpiServiceLoader.java:85)

        at org.jboss.shrinkwrap.resolver.spi.loader.ServiceRegistry.onlyOne(ServiceRegistry.java:117)

        ... 64 more

      Caused by: java.lang.reflect.InvocationTargetException

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

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

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

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

        at org.jboss.shrinkwrap.resolver.spi.loader.SpiServiceLoader.createInstance(SpiServiceLoader.java:236)

        ... 68 more

      Caused by: java.lang.NoClassDefFoundError: org/apache/maven/model/InputLocationTracker

        at org.apache.maven.model.building.DefaultModelBuilderFactory.newModelValidator(DefaultModelBuilderFactory.java:134)

        at org.apache.maven.model.building.DefaultModelBuilderFactory.newInstance(DefaultModelBuilderFactory.java:212)

        at org.jboss.shrinkwrap.resolver.impl.maven.bootstrap.MavenRepositorySystem.getRepositorySystem(MavenRepositorySystem.java:161)

        at org.jboss.shrinkwrap.resolver.impl.maven.bootstrap.MavenRepositorySystem.<init>(MavenRepositorySystem.java:73)

        at org.jboss.shrinkwrap.resolver.impl.maven.MavenWorkingSessionImpl.<init>(MavenWorkingSessionImpl.java:122)

        at org.jboss.shrinkwrap.resolver.impl.maven.MavenResolverSystemImpl.<init>(MavenResolverSystemImpl.java:43)

        ... 73 more

      Caused by: java.lang.ClassNotFoundException: org.apache.maven.model.InputLocationTracker

        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)

        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)

        at java.security.AccessController.doPrivileged(Native Method)

        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

        ... 79 more

       


      However, the exception lies about that the system couldn't invoke the createDeployment method, because I debugged the application inside it. The exception is thrown when the dependency resolver is run (as I've showed you initially), and here's my context of use:

       

      • WildFly8.0.0-Beta1
      • Arquillian1.1.1.Final
      • Eclipse Kepler 4.3 (with the Jboss Tools 4.1 pulgin)

       

      The relevant parts of my project's pom.xml, are:

       

      <dependencyManagement>

        <dependencies>

        <!-- Override dependency resolver with latest version. This must go *BEFORE* the Arquillian BOM. -->

        <dependency>

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

             <artifactId>shrinkwrap-resolver-bom</artifactId>

             <version>${version.shrinkwrap.resolvers}</version>

             <scope>import</scope>

             <type>pom</type>

        </dependency>

        <dependency>

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

             <artifactId>arquillian-bom</artifactId>

             <version>${version.arquillian_core}</version>

             <type>pom</type>

             <scope>import</scope>

        </dependency>

        </dependencies>

      </dependencyManagement>

       

      <dependencies>

         ...

        <!-- Arquillian/JUnit test environment on WildFly -->

        <dependency>

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

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

        <scope>test</scope>

        </dependency>

       

        <!-- Arquillian testing deployment container on WildFly -->

        <dependency>

        <groupId>org.wildfly</groupId>

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

        <version>8.0.0.Beta1</version>

        <scope>test</scope>

        </dependency>

       

        <!-- Shrinkwrap's resolvers; version included inside dedicated BOM -->

        <dependency>

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

        <artifactId>shrinkwrap-resolver-depchain</artifactId>

        <scope>test</scope>

        <type>pom</type>

        </dependency>

         ...

      </dependencies>


      <build>

        <!-- The JBoss AS (waiting for the proper one for WildFly) plugin deploys your war to a local

            JBoss AS (WildFly) container. To use, run: mvn package jboss-as:deploy -->

        <plugin>

           <groupId>org.jboss.as.plugins</groupId>

           <artifactId>jboss-as-maven-plugin</artifactId>

           <version>7.5.Final</version>

           <configuration>

              <groupId>org.wildfly</groupId>

              <artifactId>wildfly-dist</artifactId>

              <version>8.0.0.Beta1</version>

           </configuration>

        </plugin>

      </build>


      <profiles>

        <profile>

        <id>arquillian-wildfly-managed</id>

        <dependencies>

           <dependency>

           <groupId>org.jboss.spec</groupId>

           <artifactId>jboss-javaee-7.0</artifactId>

           <version>1.0.0.Beta2</version>

           <type>pom</type>

           <scope>provided</scope>

           </dependency>

           <dependency>

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

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

           <scope>test</scope>

           </dependency>

        </dependencies>

        <build>

        <plugins>

        <plugin>

        <groupId>org.apache.maven.plugins</groupId>

        <artifactId>maven-surefire-plugin</artifactId>

        <version>2.16</version>

        <configuration>

        <parallel>methods</parallel>

                <threadCount>10</threadCount>

        <testFailureIgnore>false</testFailureIgnore>

        <skip>false</skip>

        </configuration> 

        </plugin>

        </plugins>

        </build>

        </profile>

      </profiles>

       

       

      I final word: I tried to import the missing class the exception was talking about, contained in the maven model, but the system asked for another... bringing in this other class, the system required the first, even with the right package imported inside the dependencies section of the wildfly profile.


      Can someone please suggest something to try to workaround this issue?


      Thanks in advance!