9 Replies Latest reply on Jan 30, 2014 5:39 PM by rvcoutinho

    Arquillian in Wildfly 8.0.0.CR1

    rvcoutinho

      Hi,

       

      I have been trying to use Arquillian in a JavaEE 7 environment using Wildfly 8.0.0.CR1. But I cannot get it to work.

       

      The error is after starting the server via Arquillian. Here is the stack trace:

       

      java.lang.RuntimeException: Could not invoke deployment method: public static org.jboss.shrinkwrap.api.Archive org.dejava.component.ejb.test.component.GenericComponentDAOTest.createTestArchive()
        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: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: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:309)
        at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:147)
        at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
        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.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
        at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
        at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
        at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)
      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)
        ... 56 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 org.dejava.component.ejb.test.component.GenericComponentDAOTest.createTestArchive(GenericComponentDAOTest.java:38)
        ... 61 more
      Caused by: java.lang.ClassNotFoundException: org.jboss.shrinkwrap.resolver.spi.loader.SpiServiceLoader
        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)
        at org.jboss.shrinkwrap.resolver.api.ResolverSystemFactory.createFromUserView(ResolverSystemFactory.java:75)
        ... 65 more
      
      

       

      Also, here is part of the pom file:

       

      
      ...
      
      <dependency>
        <groupId>org.jboss.arquillian</groupId>
        <artifactId>arquillian-bom</artifactId>
        <version>1.1.2.Final</version>
        <type>pom</type>
        <scope>import</scope>
        </dependency>
      </dependencies>
      </dependencyManagement>
      
      <dependencies>
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        </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.shrinkwrap.resolver</groupId>
        <artifactId>shrinkwrap-resolver-api-maven</artifactId>
        <scope>test</scope>
        </dependency>
      
      ...
      
      
      

       

      Any ideas on how to solve this?

       

      Thanks in advance,

       

      Rômulo Coutinho.

        • 1. Re: Arquillian in Wildfly 8.0.0.CR1
          edwin.j.jaufmann.jr

          Could you please add your test case code.

          • 2. Re: Re: Arquillian in Wildfly 8.0.0.CR1
            rvcoutinho

            Hi,

             

            Here it is:

             

            /**
             * Tests for the generic EJB component and DAO.
             */
            @RunWith(Arquillian.class)
            public class GenericComponentDAOTest extends AbstractGenericComponentDAOTest {
            
            
              /**
              * Defines what should be done during deployment (before tests).
              * 
              * @return The configuration for the archive.
              */
              @Deployment
              public static Archive<?> createTestArchive() {
              // Defines and returns the archive definition.
              return ShrinkWrap
              .create(WebArchive.class, "test.war")
              .addPackages(true, "org.dejava.component.ejb")
              .addAsLibraries(
              Maven.resolver()
              .loadPomFromFile("pom.xml")
              .resolve("org.dejava.component:exception", "org.dejava.component:i18n",
              "org.dejava.component:exception", "org.dejava.component:reflection",
              "org.dejava.component:validation").withoutTransitivity().asFile())
              .addAsResource("META-INF/test-persistence.xml", "META-INF/persistence.xml")
              .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
              .addAsWebInfResource("test-ds.xml", "test-ds.xml");
              }
            
            ...
            }
            
            
            
            

             

            Thanks again,

             

            Rômulo Coutinho.

            • 3. Re: Arquillian in Wildfly 8.0.0.CR1
              jaikiran

              I've moved this to Arquillian forum. They might know more about this.

              • 4. Re: Arquillian in Wildfly 8.0.0.CR1
                kpiwko

                Hi Romulo,

                 

                this looks to me like problem with multiple non-compatible versions of ShrinkWrap on the classpath on you project. I would suggest you to do following:

                 

                1/ Force ShrinkWrap to be 1.1.x (1.1.3 is the lastest), the same way you did for arquillian-bom (put shrinkwrap-bom with scope import into dependencyManagement section)

                2/ Set up ShrinkWrap Resolver to 2.0.x (2.0.1 is the latest), again via importing shrinkwrap-resolver-bom

                3/ Use shrinkwrap-resolver-depchain as dependency that specifies ShrinkWrap Resolver instead of shrinkwrap-resolver-api-maven, you can follow this readme: shrinkwrap/resolver · GitHub

                 

                Output of mvn dependency:tree should help to figure out what versions are wrong and where they pop up from.

                 

                Karel

                • 5. Re: Arquillian in Wildfly 8.0.0.CR1
                  rvcoutinho

                  Hi,

                   

                  Thanks for the response. You could be right. The wildfly modules include the ShrinkWrap spi and api. One thing is strange though: the version of the installed module is the same as in the pom (1.1.2). Could that still be the issue?

                   

                  Thanks,

                   

                  Rômulo Coutinho.

                  • 6. Re: Arquillian in Wildfly 8.0.0.CR1
                    kpiwko

                    Might not be WF arquillian container but something else that does that, so I guess you just narrowed the problem. Can you check mvn dependency:tree for any hints? Also, have you tried to force ShrinkWrap to be 1.1.2 (step 1/ - note it has to be before arquillian-bom to apply correctly)?

                    • 7. Re: Arquillian in Wildfly 8.0.0.CR1
                      rvcoutinho

                      Hi,

                       

                      I have not tried it yet. But I will this week. I will also post the result.

                       

                      Thanks,

                       

                      Rômulo Coutinho.

                      • 8. Re: Arquillian in Wildfly 8.0.0.CR1
                        aslak

                        It seems you're only depending on the API classes, not the Impl.

                         

                        Try depending on the shrinkwrap-resolver-depchain:pom or shrinkwrap-resolver-impl-maven:jar instead of shrinkwrap-resolver-api-maven

                        • 9. Re: Arquillian in Wildfly 8.0.0.CR1
                          rvcoutinho

                          Hi.

                           

                          Sorry, I have been away for a while.

                           

                          Thanks anyway. It worked. Cannot believe I did not realize it before.

                           

                          Rômulo Coutinho.