1 Reply Latest reply on Jun 8, 2017 1:59 PM by violetagg

    Create EAR archive with web app represented by a directory and not archive

    violetagg

      Hi,

       

      I want to create EAR archive that will contain web application as directory and not .war file.

      Can you give me a hint how this can be done?

       

      Thanks a lot,

      Violeta

        • 1. Re: Create EAR archive with web app represented by a directory and not archive
          violetagg

          Hi,

           

          I tried the following:

           

              public static EnterpriseArchive createDeployment() {
                  final WebArchive webapp = ShrinkWrap.create(WebArchive.class, "test.war")
                          .addClass(TestServlet.class).addClass(TestEjb.class)
                          .setWebXML(new StringAsset(
                                  Descriptors.create(WebAppDescriptor.class)
                                      .version("3.0")
                                      .createServlet().servletName("servlet-ejb").servletClass(TestServlet.class.getName()).up()
                                      .createServletMapping().servletName("servlet-ejb").urlPattern("/ejb").up()
                                      .exportAsString()));
                  final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "test.ear");
                  final File webappDocBase= new File("./target");
                  ear.addAsDirectory(
                          webapp.as(ExplodedExporter.class)
                                  .exportExploded(webappDocBase)
                                  .getAbsolutePath());
                  return ear;
              }
          
          

           

          But when I run the test I receive the exception below:

           

          java.lang.NullPointerException
            at org.jboss.arquillian.protocol.servlet.v_2_5.ServletProtocolDeploymentPackager.handleArchive(ServletProtocolDeploymentPackager.java:87)
            at org.jboss.arquillian.protocol.servlet.v_2_5.ServletProtocolDeploymentPackager.handleArchive(ServletProtocolDeploymentPackager.java:131)
            at org.jboss.arquillian.protocol.servlet.v_2_5.ServletProtocolDeploymentPackager.generateDeployment(ServletProtocolDeploymentPackager.java:68)
            at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.buildTestableDeployments(DeploymentGenerator.java:194)
            at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.createTestableDeployments(DeploymentGenerator.java:148)
            at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.generateDeployment(DeploymentGenerator.java:85)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
          
          

           

           

          Regards,

          Violeta