Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-2779

Regression in AS7-1242 -- arquillian-service is only deployed to first container in group

    XMLWordPrintable

Details

    • Workaround Exists
    • Hide

      From conversation with Aslak:

      In regards to the issue, the problem is that we store in a HashSet which deployments has been packaged with the as7-jmx protocol so when it comes to deploy, we can determine if we need to deploy the service or not. Then we remove it from the 'marked as packaged' set. The problem comes when you have two identical deployments, they have the same hashcode, so while both deployments are marked as packaged by the jmx protocol, when the first one is being deployed, we deploy the service to server 1 and remove the mark. Then when the 'same' deployment is being deployed to server 2, it has no mark anymore so the assumption is that this is not a jmx protocol deployment and no service is deployed to server 2.

      A quick workaround is to just make the two deployments different somehow.. e.g. add a addWebInfResource(EmptyAsset.INSTANCE, "force-hashcode-change.txt") to one of the deployments.

      Show
      From conversation with Aslak: In regards to the issue, the problem is that we store in a HashSet which deployments has been packaged with the as7-jmx protocol so when it comes to deploy, we can determine if we need to deploy the service or not. Then we remove it from the 'marked as packaged' set. The problem comes when you have two identical deployments, they have the same hashcode, so while both deployments are marked as packaged by the jmx protocol, when the first one is being deployed, we deploy the service to server 1 and remove the mark. Then when the 'same' deployment is being deployed to server 2, it has no mark anymore so the assumption is that this is not a jmx protocol deployment and no service is deployed to server 2. A quick workaround is to just make the two deployments different somehow.. e.g. add a addWebInfResource(EmptyAsset.INSTANCE, "force-hashcode-change.txt") to one of the deployments.

    Description

      Blocker for clustering tests.

      /*
       * JBoss, Home of Professional Open Source.
       * Copyright 2011, Red Hat, Inc., and individual contributors
       * as indicated by the @author tags. See the copyright.txt file in the
       * distribution for a full listing of individual contributors.
       *
       * This is free software; you can redistribute it and/or modify it
       * under the terms of the GNU Lesser General Public License as
       * published by the Free Software Foundation; either version 2.1 of
       * the License, or (at your option) any later version.
       *
       * This software is distributed in the hope that it will be useful,
       * but WITHOUT ANY WARRANTY; without even the implied warranty of
       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
       * Lesser General Public License for more details.
       *
       * You should have received a copy of the GNU Lesser General Public
       * License along with this software; if not, write to the Free
       * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
       * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
       */
      
      package org.jboss.as.test.clustering.cluster;
      
      import java.io.IOException;
      import java.net.URL;
      import java.util.Properties;
      
      import javax.servlet.http.HttpServletResponse;
      
      import org.apache.http.HttpResponse;
      import org.apache.http.client.ClientProtocolException;
      import org.apache.http.client.methods.HttpGet;
      import org.apache.http.impl.client.DefaultHttpClient;
      import org.jboss.arquillian.container.test.api.Deployment;
      import org.jboss.arquillian.container.test.api.OperateOnDeployment;
      import org.jboss.arquillian.container.test.api.RunAsClient;
      import org.jboss.arquillian.container.test.api.TargetsContainer;
      import org.jboss.arquillian.junit.Arquillian;
      import org.jboss.arquillian.test.api.ArquillianResource;
      import org.jboss.as.test.clustering.single.web.SimpleServlet;
      import org.jboss.shrinkwrap.api.Archive;
      import org.jboss.shrinkwrap.api.ShrinkWrap;
      import org.jboss.shrinkwrap.api.spec.WebArchive;
      import org.junit.Assert;
      import org.junit.BeforeClass;
      import org.junit.Test;
      import org.junit.runner.RunWith;
      /**
       * Validate the <distributable/> works for single node
       * @author Paul Ferraro
       */
      @RunWith(Arquillian.class)
      @RunAsClient
      public class ClusteredWebTestCase {
      
          @BeforeClass
          public static void printSysProps() {
              Properties sysprops = System.getProperties() ;
              // System.out.println("system properties:\n" + sysprops) ;
          }
      
          @Deployment(name="deployment-0")
          @TargetsContainer("clustering-udp-0")
          public static Archive<?> deployment() {
              WebArchive war = ShrinkWrap.create(WebArchive.class, "distributable.war");
              war.addClass(SimpleServlet.class);
              war.addAsWebInfResource(ClusteredWebTestCase.class.getPackage(), "web.xml");
              System.out.println(war.toString(true));
              return war;
          }
      
          @Deployment(name="deployment-1")
          @TargetsContainer("clustering-udp-1")
          public static Archive<?> deployment2() {
              WebArchive war = ShrinkWrap.create(WebArchive.class, "distributable.war");
              war.addClass(SimpleServlet.class);
              war.addAsWebInfResource(ClusteredWebTestCase.class.getPackage(), "web.xml");
              System.out.println(war.toString(true));
              return war;
          }
      
          @Test
          @OperateOnDeployment("deployment-1")
          public void test(@ArquillianResource(SimpleServlet.class)URL baseURL) throws ClientProtocolException, IOException {
              DefaultHttpClient client = new DefaultHttpClient();
      
              // returns the URL of the deployment (http://127.0.0.1:8180/distributable)
              String url = baseURL.toString();
              System.out.println("URL = " + url);
      
              try {
                  HttpResponse response = client.execute(new HttpGet(url+"simple"));
                  Assert.assertEquals(HttpServletResponse.SC_OK, response.getStatusLine().getStatusCode());
                  Assert.assertEquals(Integer.parseInt(response.getFirstHeader("value").getValue()), 1);
                  Assert.assertFalse(Boolean.valueOf(response.getFirstHeader("serialized").getValue()));
                  response.getEntity().getContent().close();
      
                  response = client.execute(new HttpGet(url+"simple"));
                  Assert.assertEquals(HttpServletResponse.SC_OK, response.getStatusLine().getStatusCode());
                  Assert.assertEquals(Integer.parseInt(response.getFirstHeader("value").getValue()), 2);
                  // This won't be true unless we have somewhere to which to replicate
                  Assert.assertFalse(Boolean.valueOf(response.getFirstHeader("serialized").getValue()));
                  response.getEntity().getContent().close();
              } finally {
                  client.getConnectionManager().shutdown();
              }
          }
      }
      

      ARQ XML

      <?xml version="1.0" encoding="UTF-8"?>
      <arquillian xmlns="http://www.jboss.org/arquillian-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      	xsi:schemaLocation="http://www.jboss.org/arquillian-1.0 http://jboss.org/schema/arquillian/arquillian-1.0.xsd">
      
          <container qualifier="clustering-udp-single" default="true">
              <configuration>
                  <property name="jbossHome">${basedir}/target/clustering-udp-0</property>
                  <property name="javaVmArguments">${server.jvm.args} -Djboss.inst=${basedir}/target/clustering-udp-0</property>
                  <property name="serverConfig">${server.config:standalone.xml}</property>
              </configuration>
          </container>
      
          <group qualifier="clustering-udp">
      
              <container qualifier="clustering-udp-0" default="true">
                  <configuration>
                      <property name="jbossHome">${basedir}/target/clustering-udp-0</property>
                      <property name="javaVmArguments">${server.jvm.args} -Djboss.inst=${basedir}/target/clustering-udp-0</property>
                      <property name="serverConfig">${server.config:standalone-ha.xml}</property>
                  </configuration>
              </container>
      
              <container qualifier="clustering-udp-1" default="false">
                  <configuration>
                      <property name="jbossHome">${basedir}/target/clustering-udp-1</property>
                      <property name="javaVmArguments">${server.jvm.args} -Djboss.inst=${basedir}/target/clustering-udp-1 -Djboss.port.offset=100</property>
                      <property name="serverConfig">${server.config:standalone-ha.xml}</property>
                      <property name="managementPort">10099</property>
                  </configuration>
              </container>
          </group>
      
      </arquillian>
      

      server.log

      15:53:30,663 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) Starting deployment of "distributable.war"
      15:53:30,887 INFO  [org.jboss.as.server.controller] (pool-1-thread-1) Deployment of "distributable.war" was rolled back with failure message {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.deployment.unit.\"distributable.war\".POST_MODULEjboss.module.spec.service.\"deployment.arquillian-service\".mainMissing[jboss.deployment.unit.\"distributable.war\".POST_MODULEjboss.module.spec.service.\"deployment.arquillian-service\".main]","jboss.module.service.\"deployment.distributable.war\".mainjboss.module.spec.service.\"deployment.arquillian-service\".mainMissing[jboss.module.service.\"deployment.distributable.war\".mainjboss.module.spec.service.\"deployment.arquillian-service\".main]"]}
      15:53:30,896 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) Stopped deployment distributable.war in 9ms
      15:53:30,897 INFO  [org.jboss.as.controller] (pool-1-thread-1) JBAS014774: Service status report
      JBAS014775:    New missing/unsatisfied dependencies:
            service jboss.module.spec.service."deployment.arquillian-service".main (missing) dependents: [service jboss.deployment.unit."distributable.war".POST_MODULE, service jboss.module.service."deployment.distributable.war".main] 
      
      15:53:30,983 ERROR [org.jboss.as.controller] (pool-1-thread-1) JBAS014612: Operation ("undeploy") failed - address: ([("deployment" => "distributable.war")]): java.util.NoSuchElementException: No child 'runtime-name' exists
      	at org.jboss.dmr.ModelValue.requireChild(ModelValue.java:362) [jboss-dmr-1.1.0.Final.jar:]
      	at org.jboss.dmr.ModelNode.require(ModelNode.java:812) [jboss-dmr-1.1.0.Final.jar:]
      	at org.jboss.as.server.deployment.DeploymentUndeployHandler.execute(DeploymentUndeployHandler.java:58)
      	at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:322) [jboss-as-controller-7.1.0.CR1-SNAPSHOT.jar:]
      	at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:216) [jboss-as-controller-7.1.0.CR1-SNAPSHOT.jar:]
      	at org.jboss.as.controller.AbstractOperationContext.completeStep(AbstractOperationContext.java:152) [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:322) [jboss-as-controller-7.1.0.CR1-SNAPSHOT.jar:]
      	at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:216) [jboss-as-controller-7.1.0.CR1-SNAPSHOT.jar:]
      	at org.jboss.as.controller.AbstractOperationContext.completeStep(AbstractOperationContext.java:152) [jboss-as-controller-7.1.0.CR1-SNAPSHOT.jar:]
      	at org.jboss.as.controller.ModelControllerImpl$DefaultPrepareStepHandler.execute(ModelControllerImpl.java:426) [jboss-as-controller-7.1.0.CR1-SNAPSHOT.jar:]
      	at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:322) [jboss-as-controller-7.1.0.CR1-SNAPSHOT.jar:]
      	at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:216) [jboss-as-controller-7.1.0.CR1-SNAPSHOT.jar:]
      	at org.jboss.as.controller.AbstractOperationContext.completeStep(AbstractOperationContext.java:152) [jboss-as-controller-7.1.0.CR1-SNAPSHOT.jar:]
      	at org.jboss.as.controller.ModelControllerImpl.execute(ModelControllerImpl.java:115) [jboss-as-controller-7.1.0.CR1-SNAPSHOT.jar:]
      	at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler.doProcessRequest(ModelControllerClientOperationHandler.java:158) [jboss-as-controller-7.1.0.CR1-SNAPSHOT.jar:]
      	at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler.access$100(ModelControllerClientOperationHandler.java:89) [jboss-as-controller-7.1.0.CR1-SNAPSHOT.jar:]
      	at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler$1.call(ModelControllerClientOperationHandler.java:118) [jboss-as-controller-7.1.0.CR1-SNAPSHOT.jar:]
      	at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler$1.call(ModelControllerClientOperationHandler.java:116) [jboss-as-controller-7.1.0.CR1-SNAPSHOT.jar:]
      	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [:1.6.0_29]
      	at java.util.concurrent.FutureTask.run(FutureTask.java:138) [:1.6.0_29]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_29]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_29]
      	at java.lang.Thread.run(Thread.java:662) [:1.6.0_29]
      
      15:53:31,157 INFO  [org.apache.catalina.core.StandardContext] (MSC service thread 1-1) Container org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/] has not been started
      15:53:31,159 INFO  [org.jboss.as.deployment.connector] (MSC service thread 1-1) JBAS010410: Unbound JCA ConnectionFactory [java:/JmsXA]
      

      Attachments

        Issue Links

          Activity

            People

              aslak@redhat.com Aslak Knutsen
              rhn-engineering-rhusar Radoslav Husar
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: