0 Replies Latest reply on Oct 25, 2011 1:51 PM by Alex Landini

    Arquillian Web Service Test dependencies problem

    Alex Landini Newbie

      I'm trying to do a test client for a web service.

       

      My test class look like this one:

       

      @RunWith(Arquillian.class)
      public class SyncInfoWSTest {
          
          public static String wsdlURL = "---";
          
          protected ServerWS server;  
          
          /**
           * Build test packages with all the dependencies.
           * 
           * @return
           */
          @Deployment(testable = false)
          public static WebArchive createTestArchive() {
      
              JavaArchive arch = ShrinkWrap.create(JavaArchive.class, "test.jar").addAsManifestResource("persistence-test.xml", ArchivePaths.create("persistence.xml"))
                      .addPackages(true, "com/services").addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));
      
              WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "test.war").setWebXML("test-web.xml").addAsLibrary(arch);
      
              System.out.println("### building " + arch.getName());
      
              return webArchive;
      
          }
      
          @Before
          public void setUp(){
              try {
                 ServerWSService syncInfoWSService = new ServerWSService(new URL(wsdlURL));
                  server = syncInfoWSService.getServerWSPort();
                  if (server == null) {
                      fail("server error");
                  }
              } catch (Exception e) {
                  fail(e.getMessage());
              }
          }
          
          /**
           * Test di verifica di scrittura di un {@code Customer} quando da già esiste.
           * @throws Exception 
           */
          @Test
          public void testDoTest() throws Exception {
      
             String result =  server.operation();        
                              
              assertNull(result);
              
          }
      

       

      I use remote JBoss as 6.1.0 container, test dependencies are as follows:

       

      the bom

       

      <dependency>

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

             <artifactId>arquillian-bom</artifactId>

             <version>1.0.0.CR4</version>

             <scope>import</scope>

             <type>pom</type>

      </dependency>  

       

      and

       

      <dependency>

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

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

         <scope>test</scope>

      </dependency>

       

      <dependency>

          <groupId>junit</groupId>

          <artifactId>junit</artifactId>

           <scope>test</scope>

      </dependency>

       

      But when I execute the test I get the following:

       

      java.lang.NoClassDefFoundError: javax/xml/ws/spi/Provider21

          at java.lang.ClassLoader.defineClass1(Native Method)

          at java.lang.ClassLoader.defineClass(ClassLoader.java:634)

          at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)

          at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)

          at java.net.URLClassLoader.access$000(URLClassLoader.java:73)

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

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

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

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

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

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

          at javax.xml.ws.spi.FactoryFinder.safeLoadClass(FactoryFinder.java:170)

          at javax.xml.ws.spi.FactoryFinder.newInstance(FactoryFinder.java:50)

          at javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:110)

          at javax.xml.ws.spi.Provider.provider(Provider.java:102)

          at javax.xml.ws.Service.<init>(Service.java:76)

          at com.eggsweb.sync.webservice.clientstub.SyncInfoWSService.<init>(SyncInfoWSService.java:42)

          at com.eggsweb.sync.webservice.ws.SyncInfoWSTest.setUp(SyncInfoWSTest.java:67)

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

          at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)

          at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)

          at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)

          at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)

          at org.jboss.arquillian.junit.Arquillian$StatementLifecycleExecutor.invoke(Arquillian.java:327)

          at org.jboss.arquillian.container.test.impl.execution.ClientBeforeAfterLifecycleEventExecuter.execute(ClientBeforeAfterLifecycleEventExecuter.java:99)

          at org.jboss.arquillian.container.test.impl.execution.ClientBeforeAfterLifecycleEventExecuter.on(ClientBeforeAfterLifecycleEventExecuter.java:72)

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

          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

          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.container.test.impl.client.ContainerEventController.createContext(ContainerEventController.java:130)

          at org.jboss.arquillian.container.test.impl.client.ContainerEventController.createBeforeContext(ContainerEventController.java:112)

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

          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

          at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:82)

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

          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

          at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:68)

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

          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

          at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:54)

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

          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

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

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

          at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.before(EventTestRunnerAdaptor.java:95)

          at org.jboss.arquillian.junit.Arquillian$4.evaluate(Arquillian.java:198)

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

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

          at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:216)

          at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)

          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)

          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)

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

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

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

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

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

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

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

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

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

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

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

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

          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.ClassNotFoundException: javax.xml.ws.spi.Provider21

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

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

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

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

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

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

          ... 92 more

       

       

      Thanks in advance

      Alex