1 Reply Latest reply on Dec 2, 2014 3:28 AM by stefan.grossmann

    Undertow error with multiple deployments on Wildfly 8.2

    stefan.grossmann

      I have the following test:

       

      @RunWith(Arquillian.class)
      public class ClassLoaderResolverASIT {
      
          private static final Logger LOG = LoggerFactory.getLogger(ClassLoaderResolverASIT.class);
      
          @Deployment(name = "deploymentA", order = 1)
          public static EnterpriseArchive createDeployment1() {
      
              final JavaArchive jar =
                      ShrinkWrap.create(JavaArchive.class)
                          .addClass(ClassLoaderResolverASIT.class);
              LOG.debug(jar.toString(true));
      
              final EnterpriseArchive ear =
                      ShrinkWrap.create(EnterpriseArchive.class, "deployment-A.ear")
                          .addAsLibrary(jar);
      
              LOG.debug(ear.toString(true));
              return ear;
          }
      
          @Deployment(name = "deploymentB", order = 2)
          public static EnterpriseArchive createDeployment3() {
      
              final JavaArchive jar =
                      ShrinkWrap.create(JavaArchive.class)
                          .addClass(ClassLoaderResolverASIT.class);
              LOG.debug(jar.toString(true));
      
              final EnterpriseArchive ear =
                      ShrinkWrap.create(EnterpriseArchive.class, "deployment-B.ear")
                          .addAsLibrary(jar);
      
              LOG.debug(ear.toString(true));
              return ear;
          }
      
      
      
          @Test
          public void testDummy() throws IOException {
              LOG.error("Hello");
          }
      }
      

       

      When I try to execute this, the deployment of the second test fails:

       

      17:25:52,224 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC000001: Failed to start service jboss.deployment.subunit."deployment-B.ear"."test.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."deployment-B.ear"."test.war".INSTALL: JBAS018733: Failed to process phase INSTALL of subdeployment "test.war" of deployment "deployment-B.ear"
          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_25]
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_25]
          at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_25]
      Caused by: org.jboss.msc.service.DuplicateServiceException: Service jboss.undertow.deployment.default-server.default-host./test.codec is already registered
          at org.jboss.msc.service.ServiceRegistrationImpl.setInstance(ServiceRegistrationImpl.java:158) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
          at org.jboss.msc.service.ServiceControllerImpl.startInstallation(ServiceControllerImpl.java:235) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
          at org.jboss.msc.service.ServiceContainerImpl.install(ServiceContainerImpl.java:767) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
          at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:223) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
          at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2401) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
          at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:223) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
          at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2401) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
          at org.jboss.msc.service.ServiceBuilderImpl.install(ServiceBuilderImpl.java:317) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
          at org.wildfly.extension.undertow.deployment.UndertowDeploymentProcessor.installSessionIdentifierCodec(UndertowDeploymentProcessor.java:375)
          at org.wildfly.extension.undertow.deployment.UndertowDeploymentProcessor.processDeployment(UndertowDeploymentProcessor.java:294)
          at org.wildfly.extension.undertow.deployment.UndertowDeploymentProcessor.deploy(UndertowDeploymentProcessor.java:117)
          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
          ... 5 more
      
      17:25:52,227 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 1) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "deployment-B.ear")]) - failure description: {
          "JBAS014671: Failed services" => {"jboss.deployment.subunit.\"deployment-B.ear\".\"test.war\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.subunit.\"deployment-B.ear\".\"test.war\".INSTALL: JBAS018733: Failed to process phase INSTALL of subdeployment \"test.war\" of deployment \"deployment-B.ear\"
          Caused by: org.jboss.msc.service.DuplicateServiceException: Service jboss.undertow.deployment.default-server.default-host./test.codec is already registered"},
          "JBAS014771: Services with missing/unavailable dependencies" => ["jboss.deployment.unit.\"deployment-B.ear\".deploymentCompleteService is missing [jboss.deployment.subunit.\"deployment-B.ear\".\"test.war\".deploymentCompleteService]"]
      }
      

       

      Aquillian.xml is:

       

      <?xml version="1.0" encoding="UTF-8"?>
      <arquillian xmlns="http://jboss.org/schema/arquillian" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
      
          <container qualifier="jbossas-remote">
              <configuration>
                  <property name="managementAddress">localhost</property>
                  <property name="managementPort">9990</property>
      
              </configuration>
          </container>
      </arquillian>
      

       

      The maven profile:

      <profile>
        <id>jbossas-remote</id>
        <activation>
          <property>
            <name>it</name>
            <value>jbossas-remote</value>
          </property>
        </activation>
        <properties>
          <failsafe.skipITs>false</failsafe.skipITs>
        </properties>
        <dependencies>
          <!-- Arquillian container adapter -->
          <dependency>
            <groupId>org.wildfly</groupId>
            <artifactId>wildfly-arquillian-container-remote</artifactId>
            <scope>test</scope>
              <type>jar</type>
              <exclusions>
                <exclusion>
                  <!-- exclude with Java 8 - otherwise eclipse .m2 becomes crazy (JDK 8 u 25) -->
                  <groupId>sun.jdk</groupId>
                  <artifactId>jconsole</artifactId>
                </exclusion>
              </exclusions>
          </dependency>
        </dependencies>
        <build>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-failsafe-plugin</artifactId>
              <configuration>
                <systemPropertyVariables>
                  <arquillian.launch>jbossas-remote</arquillian.launch>
                </systemPropertyVariables>
                <includes>
                  <include>**/*ASIT.java</include>
                </includes>
              </configuration>
            </plugin>
          </plugins>
        </build>
      </profile>
      

       

      We had a test like this which was working with JBoss AS 7 and Java 8.

      Any Ideas what I can do?

        • 1. Re: Undertow error with multiple deployments on Wildfly 8.2
          stefan.grossmann

          For my special scenario the test just needs to run in one deployment (which has dependencies to the other one). Therefore the following workaround helps:

           

          @Deployment(name = "deploymentB", order = 2, testable=false)
          public static EnterpriseArchive createDeployment2() {
          ...
          }
          
          .

           

          With the "testable=false" the test is deploying without errors. Nevertheless, there might be scenarios where both deployments need to be testable.