5 Replies Latest reply on May 4, 2014 4:30 PM by bmajsak

    ResourceAdapterArchive deployment error

    le2tbomi

      Hi all,

       

      When i try to deploy a ResourceAdapterArchive, i get this error

       

      java.lang.IllegalArgumentException: org.jboss.arquillian.protocol.servlet.v_3.ServletProtocolDeploymentPackager can not handle archive of type org.jboss.shrinkwrap.impl.base.spec.ResourceAdapterArchiveImpl

       

      I you want the stack trace, i can paste it here, but think the message is explicit.

       

      The code is like this :

       

      @Deployment(name="resource", order = 1)
          public static ResourceAdapterArchive createResourceArchive() throws IOException, XmlPullParserException {
              ResourceAdapterArchive result = ShrinkWrap.create(ResourceAdapterArchive.class, RAR_NAME_ARCHIVE);
      
              result.addAsLibraries(ArquillianArchiveHelper.getInstance().getResolver().resolve("group:ra-ftp:1.0.0-SNAPSHOT").withTransitivity().as(File.class));
              result.addAsManifestResource(new ByteArrayAsset("<connector xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd\" version=\"1.6\"/>".getBytes()), "ra.xml");
      
              return result;
          }
      

       

      And the dependencyManagement section in pom is like this :

       

      <dependencyManagement>
              <dependencies>
                  <dependency>
                      <groupId>org.jboss.shrinkwrap.resolver</groupId>
                      <artifactId>shrinkwrap-resolver-bom</artifactId>
                      <version>2.0.0-alpha-4</version>
                      <scope>import</scope>
                      <type>pom</type>
                  </dependency>
                  <dependency>
                      <groupId>org.jboss.arquillian</groupId>
                      <artifactId>arquillian-bom</artifactId>
                      <version>1.0.3.Final</version>
                      <scope>import</scope>
                      <type>pom</type>
                  </dependency>
              </dependencies>
          </dependencyManagement>
      

       

      Finally, i use glassfish 3.1 as container.

       

      Someone has an idea to solve this problem ? I didn't found on google error like this and i have looked in ironjacamar but it seems that wouldn't help.

        • 1. Re: ResourceAdapterArchive deployment error
          le2tbomi

          Hi,

           

          I am surprised that nobody can help me. Is there any problem with my question ?

          • 2. Re: ResourceAdapterArchive deployment error
            vineet.reynolds

            This looks like a failure during enhancement of the ResourceAdapter before deployment. The Arquillian Servlet protocol enhances a testable deployment with a servlet (for GlassFish), so that the client can communicate with the testrunner on the server. In the case of a RAR deployment, a servlet could/may not be added, and hence the failure. I'm not sure if it is possible to even add a Servlet to a RAR deployment, and access the servlet from the client.

             

            As a workaround, you could create an EAR with an embedded RAR - the resource adapter would be visible from within the EAR. Getting the right structure for your EAR will require some knowledge about how Arquillian enhances the deployment with the testrunner, enrichers and the testclasses. You may find some help in this space, by exporting the deployment and verifying it's contents: http://arquillian.org/guides/getting_started_rinse_and_repeat/#export_the_deployment

            • 3. Re: ResourceAdapterArchive deployment error
              le2tbomi

              Thank for your answer. I have ever tried this solution but i will try again after reading your article and come back after.

              • 4. Re: ResourceAdapterArchive deployment error
                vineet.reynolds

                There are some finer nuances about how the ServletProtocolDeploymentPackager operates. For example, if it doesn't find a WAR in the EAR file you've constructed, it goes ahead and constructs one, and add the Servlet protocol jar as a library in the WAR. But overall, if you should be able to bypass that exception if you create an EnterpriseArchive or a WebArchive that wraps your ResourceAdapterArchive and your test uses it as an embedded resource adapter. The exception you encounter, is thrown only if your deployment is not of type JavaArchive, WebArchive or EnterpriseArchive.

                 

                Also, the RAR archive might have to be registered as a module within the EAR that you construct so that it is visible to your test. Your connector connection pools and resources may also need to refer to the embedded resource adapter as App-Name#Connector-Name.

                • 5. Re: ResourceAdapterArchive deployment error
                  bmajsak

                  It's a bit too late to the party, but as vineet.reynolds pointed out at some point Arquillian is not able to enhance the deployment when it's testable.

                  On the other hand you most likely do not need to test Resource Adapter itself, rather the application which will be using it. Therefore add testable = false to @Deployment annotation and deploy your additional test deployment as usual.