This content has been marked as final.
Show 1 reply
-
1. Re: Create EAR archive with web app represented by a directory and not archive
violetagg Jun 8, 2017 1:59 PM (in response to 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