1 Reply Latest reply on May 15, 2017 10:14 AM by nicolas duminil

    JAX-RS 2.0 client works properly but returns HTTP 404 when executing with Arquillian

    nicolas duminil Master

      Hello,

       

      I'm deplying some JAX-RS 2.0 (Apache CXF 3.0) services on WebSphere AS 9.0.0.3. I run a JAX-RS program which uses javax.ws.rs.client.Client to connect to the services to perform some GET/POST operations. While ran with JUnit, after having deployed the services on the application server, this works properly. Now I'm uninstalling the services and I perform an Arquillian test when the same JAX-RS client is executed. The war to be deployed is created as follows:

       

      @Deployment

        public static Archive<?> createTestArchive() throws Exception

        {

          return ShrinkWrap.createFromZipFile(WebArchive.class, new File("target/MyServiceWAR.war"));

        }

       

      So it uses the same WAR as the JUnit test built by the "mvn -DskipTests clean package" executed just before launching the Arquillian test. The deployment succeeds as the following messages are displayed in the console:

       

      [14/05/17 12:07:27:559 CEST] 0000003f ApplicationMg A   WSVR0221I: Application started: MyServiceWAR

      [14/05/17 12:07:27:559 CEST] 0000003f CompositionUn A   WSVR0191I: Composition unit WebSphere:cuname=EchoServiceWAR in BLA WebSphere:blaname=MyServiceWAR started.

      [14/05/17 12:07:29:184 CEST] 000000b6 ServletWrappe I com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0242I: [MyServiceWAR] [/MyServiceWAR] [ArquillianServletRunner]: Initialization successful.

       

      But the connection to the service fails with the exception:

       

      HTTP 404 com.ibm.ws.webcontainer.servlet.exception.NoTargetForURIException: No target servlet configured for uri: /myservice/services/documents/test.

       

      Of course, the URL above is the same that the one used by the same code ran in a JUnit test. I have to mention that the context-root (/myservice) is set in the ibm-web-ext.xml file, as required for IBM WebSphere.

       

      Could be that Arquillian for WebSphere doesn't support the definition of the context-root in the ibm-web-ext.xml file ?

       

      Kind regards,

       

      Nicolas

        • 1. Re: JAX-RS 2.0 client works properly but returns HTTP 404 when executing with Arquillian
          nicolas duminil Master

          I'm replying to my own post. It seems that, as a matter of fact, Arquillian for Websphere is not able to use the information in the IBM extension files and, hence, the deployed WAR url uses the maven ${project.artifactId} as context-root.

          So, I added to following to my Arquillian test:

           

            @ArquillianResource

            private URL baseURL;

           

          Now, I'm using baseURL to compose the JAX-RS endpoint but I'm experiencing another exception:

           

          org.jboss.arquillian.test.spi.ArquillianProxyException: javax.ws.rs.client.ResponseProcessingException : Problem with reading the data, class be.alphacredit.services.esign.model.QuickSignRootResource, ContentType: application/json. [Proxied because : Original exception caused: class java.io.NotSerializableException: org.apache.cxf.jaxrs.impl.ResponseImpl]

           

          The exactly same code works properly when ran in a plain JUnit test, once that the WAR has been deployed using the WAS maven plugin.

           

          Any idea of what could be wrong here ? By the way, I'm using here org.jboss.arquillian.container:arquillian-was-remote-8.5:1.0.0.Final-SNAPSHOT. This to be used with WebSphere 8.5.5? Is there any WebSphere 9.0 Arquillian plugin ?

           

          Kind regards,

           

          Nicolas