Multiple deployment scenario - the same JAR deployed more than once (programmer's
mistake) without error
---------------------------------------------------------------------------------------------------------
Key: ARQ-698
URL:
https://issues.jboss.org/browse/ARQ-698
Project: Arquillian
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: JBoss Containers
Affects Versions: 1.0.0.CR6
Reporter: Pavel Janousek
Priority: Critical
Let imagine, we've TestCase like this:{code}@RunWith(Arquillian.class)
public class CopyOfJaxrsJSApiTestCase {
@Deployment(name="dep1")
public static Archive<?> deploy1() {
WebArchive war = ShrinkWrap.create(WebArchive.class, "jaxrsnoap.war");
war.addPackage(HttpRequest.class.getPackage());
war.addPackage(CopyOfJaxrsJSApiTestCase.class.getPackage());
war.addAsWebInfResource(WebXml.get(
"<servlet-mapping>\n" +
"
<servlet-name>javax.ws.rs.core.Application</servlet-name>\n" +
" <url-pattern>/myjaxrs1/*</url-pattern>\n"
+
"</servlet-mapping>\n" +
"\n"),"web.xml");
return war;
}
@Deployment(name="dep2")
public static Archive<?> deploy2() {
WebArchive war = ShrinkWrap.create(WebArchive.class, "jaxrsnoap.war");
war.addPackage(HttpRequest.class.getPackage());
war.addPackage(CopyOfJaxrsJSApiTestCase.class.getPackage());
war.addAsWebInfResource(WebXml.get(
"<servlet-mapping>\n" +
"
<servlet-name>javax.ws.rs.core.Application</servlet-name>\n" +
" <url-pattern>/myjaxrs2/*</url-pattern>\n"
+
"</servlet-mapping>\n" +
"\n"),"web.xml");
return war;
}
private static String performCall(String urlPattern) throws Exception {
return HttpRequest.get("http://localhost:8080/jaxrsnoap/" + urlPattern,
5, TimeUnit.SECONDS);
}
@Test @OperateOnDeployment("dep1")
public void testJaxRsWithNoApplication1() throws Exception {
String result = performCall("myjaxrs1/jsapi");
Assert.assertEquals("<?xml version=\"1.0\"
encoding=\"UTF-8\"
standalone=\"yes\"?><customer><first>John</first><last>Citizen</last></customer>",
result);
}
@Test @OperateOnDeployment("dep2")
public void testJaxRsWithNoApplication2() throws Exception {
String result = performCall("myjaxrs2/jsapi");
Assert.assertEquals("<?xml version=\"1.0\"
encoding=\"UTF-8\"
standalone=\"yes\"?><customer><first>John</first><last>Citizen</last></customer>",
result);
}
}{code}
We've two deployments, but current implementation packages both of them as the same
JAR (accidentally). The present behavior is that only the first one WAR is deployed, so
the second test (testJaxRsWithNoApplication2) fails. In the LOG file I
see:{code}10:12:59,954 INFO [org.jboss.as.server.deployment.repository.impl]
(pool-1-thread-2) JBAS014900: Content added at location
/home/pjanouse/github/jboss-as/testsuite/integration/basic/target/jbossas/standalone/data/content/c1/6dd22b512f47bc27788501e587813215429ce2/content
10:12:59,959 INFO [org.jboss.as.server.deployment] (MSC service thread 1-6) Starting
deployment of "jaxrsnoap.war"
10:13:00,160 INFO [org.jboss.as.arquillian] (MSC service thread 1-7) Arquillian
deployment detected:
ArquillianConfig[service=jboss.arquillian.config."jaxrsnoap.war",unit=jaxrsnoap.war,tests=[org.jboss.as.test.integration.jaxrs.jsapi.JaxrsJSApiTestCase,
org.jboss.as.test.integration.jaxrs.jsapi.CopyOfJaxrsJSApiTestCase]]
10:13:00,255 INFO [org.jboss.web] (MSC service thread 1-3) registering web context:
/jaxrsnoap
10:13:00,281 INFO [org.jboss.as.server.controller] (pool-1-thread-2) Deployed
"jaxrsnoap.war"
10:13:00,320 INFO [org.jboss.as.server.deployment.repository.impl] (pool-1-thread-2)
JBAS014900: Content added at location
/home/pjanouse/github/jboss-as/testsuite/integration/basic/target/jbossas/standalone/data/content/43/9562609e3b8fdf3afdd6d456fc5d8db1132fca/content
10:13:01,045 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) Stopped
deployment jaxrsnoap.war in 42ms
10:13:01,055 INFO [org.jboss.as.server.deployment.repository.impl] (pool-1-thread-2)
JBAS014901: Content removed from location
/home/pjanouse/github/jboss-as/testsuite/integration/basic/target/jbossas/standalone/data/content/c1/6dd22b512f47bc27788501e587813215429ce2/content
10:13:01,056 INFO [org.jboss.as.server.controller] (pool-1-thread-2) Undeployed
"jaxrsnoap.war"
10:13:01,067 ERROR [org.jboss.as.controller.management-operation] (pool-1-thread-1)
JBAS014612: Operation ("undeploy") failed - address: ([("deployment"
=> "jaxrsnoap.war")]): java.util.NoSuchElementException: No child
'runtime-name' exists
at org.jboss.dmr.ModelValue.requireChild(ModelValue.java:362)
[jboss-dmr-1.1.1.Final.jar:]
at org.jboss.dmr.ModelNode.require(ModelNode.java:812)
[jboss-dmr-1.1.1.Final.jar:]
at
org.jboss.as.server.deployment.DeploymentUndeployHandler.execute(DeploymentUndeployHandler.java:58)
at
org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:339)
[jboss-as-controller-7.1.0.CR1-SNAPSHOT.jar:]
at
org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:234)
[jboss-as-controller-7.1.0.CR1-SNAPSHOT.jar:]
at
org.jboss.as.controller.AbstractOperationContext.completeStep(AbstractOperationContext.java:170)
[jboss-as-controller-7.1.0.CR1-SNAPSHOT.jar:]
at
org.jboss.as.controller.CompositeOperationHandler.execute(CompositeOperationHandler.java:84)
[jboss-as-controller-7.1.0.CR1-SNAPSHOT.jar:]
at
org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:339)
[jboss-as-controller-7.1.0.CR1-SNAPSHOT.jar:]
at
org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:234)
[jboss-as-controller-7.1.0.CR1-SNAPSHOT.jar:]
at
org.jboss.as.controller.AbstractOperationContext.completeStep(AbstractOperationContext.java:170)
[jboss-as-controller-7.1.0.CR1-SNAPSHOT.jar:]
at
org.jboss.as.controller.ModelControllerImpl$DefaultPrepareStepHandler.execute(ModelControllerImpl.java:432)
[jboss-as-controller-7.1.0.CR1-SNAPSHOT.jar:]
at
org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:339)
[jboss-as-controller-7.1.0.CR1-SNAPSHOT.jar:]
at
org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:234)
[jboss-as-controller-7.1.0.CR1-SNAPSHOT.jar:]
at
org.jboss.as.controller.AbstractOperationContext.completeStep(AbstractOperationContext.java:170)
[jboss-as-controller-7.1.0.CR1-SNAPSHOT.jar:]
at
org.jboss.as.controller.ModelControllerImpl.execute(ModelControllerImpl.java:119)
[jboss-as-controller-7.1.0.CR1-SNAPSHOT.jar:]
at
org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler.doExecute(ModelControllerClientOperationHandler.java:121)
[jboss-as-controller-7.1.0.CR1-SNAPSHOT.jar:]
at
org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler$1.execute(ModelControllerClientOperationHandler.java:98)
[jboss-as-controller-7.1.0.CR1-SNAPSHOT.jar:]
at
org.jboss.as.protocol.mgmt.AbstractMessageHandler$3$1.doExecute(AbstractMessageHandler.java:268)
[jboss-as-protocol-7.1.0.CR1-SNAPSHOT.jar:]
at
org.jboss.as.protocol.mgmt.AbstractMessageHandler$AsyncTaskRunner.run(AbstractMessageHandler.java:424)
[jboss-as-protocol-7.1.0.CR1-SNAPSHOT.jar:]
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
[:1.6.0_27]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
[:1.6.0_27]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_27]
{code}
As you can see, there is an attempt to deploy jaxrsnoap.war again, ARQ is thinking
it's OK and after that it tries to undeploy them two times too.
I've created this scenario by my error, but I'm expecting:
a) second attempt of deploy raises exception as the same WAR application is already
deployed (similar to produce error if there are two deployment without the different
name)
b) the second attempt at least re-deploy the application
Ad B) AS7 admin console doesn't allow to deploy some WAR with the same name more than
once. I'm preferring behavior as ad A)
Make sense for you?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira