0

I have a problem running integration-test with maven failsafe-plugin using wildfly 10x embedded container. The embedded container is composed and running by Cargo maven plugin. These plugin downloads wildfly server, installs it, and start and stop the wildfly container before and then after integration test phase. For IT i use Arquillian and durign this phase i get an Exception:

20:50:26,147 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.patching.manager: org.jboss.msc.service.StartException in service jboss.patching.manager: java.lang.IllegalStateException: Duplicate layer 'base'
    at org.jboss.as.patching.installation.InstallationManagerService.start(InstallationManagerService.java:86)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: Duplicate layer 'base'
    at org.jboss.as.patching.installation.LayersFactory$ProcessedLayers.addLayer(LayersFactory.java:305)
    at org.jboss.as.patching.installation.LayersFactory.processRoot(LayersFactory.java:182)
    at org.jboss.as.patching.installation.LayersFactory.process(LayersFactory.java:127)
    at org.jboss.as.patching.installation.LayersFactory.load(LayersFactory.java:86)
    at org.jboss.as.patching.installation.InstallationManagerImpl.<init>(InstallationManagerImpl.java:47)
    at org.jboss.as.patching.installation.InstallationManager.load(InstallationManager.java:185)
    at org.jboss.as.patching.installation.InstallationManagerService.load(InstallationManagerService.java:108)
    at org.jboss.as.patching.installation.InstallationManagerService.start(InstallationManagerService.java:62)
    ... 5 more

20:50:26,272 WARN  [org.jboss.as.domain.management.security] (MSC service thread 1-2) WFLYDM0111: Keystore E:\java\javaee8sec\javaee8sec\cargo\wildfly-10.1.0.Final\wildfly-10.1.0.Final\standalone\configuration\application.keystore not found, it will be auto generated on first use with a self signed certificate for host localhost
20:50:26,334 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-1) WFLYDS0013: Started FileSystemDeploymentService for directory E:\java\javaee8sec\javaee8sec\cargo\wildfly-10.1.0.Final\wildfly-10.1.0.Final\standalone\deployments
20:50:26,537 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0006: Undertow HTTPS listener https listening on 127.0.0.1:8443
20:50:27,366 INFO  [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-4) ISPN000128: Infinispan version: Infinispan 'Chakra' 8.2.4.Final
20:50:27,460 INFO  [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 59) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.
20:50:27,460 INFO  [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 62) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.
20:50:27,460 INFO  [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 59) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.
20:50:27,460 INFO  [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 61) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.
20:50:27,460 INFO  [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 62) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.
20:50:27,460 INFO  [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 61) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.
20:50:27,897 INFO  [org.jboss.ws.common.management] (MSC service thread 1-2) JBWS022052: Starting JBossWS 5.1.5.Final (Apache CXF 3.1.6) 
20:50:27,897 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("boottime-controller-initializer-step") failed - address: ([]) - failure description: {
    "WFLYCTL0080: Failed services" => {"jboss.patching.manager" => "org.jboss.msc.service.StartException in service jboss.patching.manager: java.lang.IllegalStateException: Duplicate layer 'base'
    Caused by: java.lang.IllegalStateException: Duplicate layer 'base'"},
    "WFLYCTL0412: Required services that are not installed:" => ["jboss.patching.manager"],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => undefined
}
20:50:27,928 INFO  [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
WFLYCTL0186:   Services which failed to start:      service jboss.patching.manager: org.jboss.msc.service.StartException in service jboss.patching.manager: java.lang.IllegalStateException: Duplicate layer 'base'

20:50:28,085 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9050/management
20:50:28,085 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9050
20:50:28,085 ERROR [org.jboss.as] (Controller Boot Thread) WFLYSRV0026: WildFly Full 10.1.0.Final (WildFly Core 2.2.0.Final) started (with errors) in 15471ms - Started 339 of 586 services (1 services failed or missing dependencies, 394 services are lazy, passive or on-demand)
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 63.843 s <<< FAILURE! - in id.swhp.javaee.soteria.business.security.boundary.ArquillianEmptyTestIT
[ERROR] id.swhp.javaee.soteria.business.security.boundary.ArquillianEmptyTestIT  Time elapsed: 63.843 s  <<< ERROR!
org.jboss.arquillian.container.spi.client.container.LifecycleException: Could not start container
Caused by: java.util.concurrent.TimeoutException: Managed server was not started within [60] s

[INFO] 
[INFO] Results:
[INFO] 
[ERROR] Errors: 
[ERROR]   ArquillianEmptyTestIT.id.swhp.javaee.soteria.business.security.boundary.ArquillianEmptyTestIT ยป Lifecycle
[INFO] 
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

JDK 1.8, JEE 8, IntelliJ IDEA 2017.2.5 The maven pom is composed by 3 profiles:

- default: compile and package classes into war files (there is wildfly plugin to deploy it remotely)
- setup-cargo: download wildfly and install it (this is the only phase for cargo). Then maven resources plugin install the dependent resources like modules, standalone.xml modified with the right driver and datasource jndi reference, and others eventually dependencies for working.
- runcargo: runs integration test and start and stop the container 

Outside my properties you find the surefire plugin with skipTest =true (for now) for just Junit tests that don't need an enterprise container.

My steps for build and running IT tests are:
1)mvn clean install -P default
2)mvn install -P setup-cargo
3)mvn failsafe:integration-test -P runcargo

my pom.xml and Arquillian xml files show here, what's wrong? thanks in advice

<packaging>war</packaging>
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <failOnMissingWebXml>false</failOnMissingWebXml>
    <jee.api.version>8.0</jee.api.version>
    <hibernate.version>5.0.0.Final</hibernate.version>
    <IT.skipTests>false</IT.skipTests><!--avvia cargo e lancia i test di integrazione -->
    <JunitTest.skip>true</JunitTest.skip> <!--per ora i test junit sono fermi-->
    <wildfly.home.module>${project.basedir}/cargo/wildfly-10.1.0.Final/wildfly-10.1.0.Final</wildfly.home.module>
    <jboss.home>${wildfly.home.module}</jboss.home>
</properties>
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.jboss.arquillian</groupId>
            <artifactId>arquillian-bom</artifactId>
            <version>1.1.13.Final</version>
            <scope>import</scope>
            <type>pom</type>
        </dependency>
    </dependencies>
</dependencyManagement>
<dependencies>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-api</artifactId>
        <version>${jee.api.version}</version>
        <scope>provided</scope>
    </dependency>
    <!-- Security API -->
    <dependency>
        <groupId>org.glassfish.soteria</groupId>
        <artifactId>javax.security.enterprise</artifactId>
        <version>1.0</version>
    </dependency>
    <!-- Omnifaces, develop JSF never easier without Omnifaces -->
    <dependency>
        <groupId>org.omnifaces</groupId>
        <artifactId>omnifaces</artifactId>
        <version>2.6.4</version>
    </dependency>
    <dependency>
        <groupId>org.hsqldb</groupId>
        <artifactId>hsqldb</artifactId>
        <version>2.3.2</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-tools</artifactId>
        <version>${hibernate.version}</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>4.1.0.Final</version>
        <scope>provided</scope>
    </dependency>
    <!--test scope -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <version>2.15.0</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.arquillian.junit</groupId>
        <artifactId>arquillian-junit-container</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.wildfly.arquillian</groupId>
        <artifactId>wildfly-arquillian-container-managed</artifactId>
        <version>2.1.0.Final</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>3.8.0</version>
        <scope>test</scope>
    </dependency>
</dependencies>
<build>
    <finalName>${project.artifactId}-${project.version}</finalName> <!--javaee-soteria-1.0.0.war-->
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.20.1</version>
                <configuration>
                    <systemPropertyVariables>
                        <jboss.home>${jboss.home}</jboss.home>
                        <module.path>${jboss.home}/modules</module.path>
                    </systemPropertyVariables>
                    <skipTests>${JunitTest.skip}</skipTests>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>
<profiles>
    <profile>
        <id>default</id>
       <activation>
           <activeByDefault>true</activeByDefault>
       </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <configuration>
                        <webResources>
                            <resource>
                                <directory>src/main/webapp/WEB-INF</directory>
                                <targetPath>WEB-INF</targetPath>
                                <includes>
                                    <include>*.xml</include>
                                </includes>
                                <filtering>true</filtering>
                            </resource>
                        </webResources>
                    </configuration>
                </plugin>
                <!--for deploy on external wildfly server-->
                <plugin>
                    <groupId>org.wildfly.plugins</groupId>
                    <artifactId>wildfly-maven-plugin</artifactId>
                    <version>1.2.1.Final</version>
                    <configuration>
                        <hostname>127.0.0.1</hostname>
                        <port>9090</port>
                        <username>admin</username>
                        <password>admin</password>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>
    <profile>
        <id>setup-cargo</id>
        <activation>
            <property>
                <name>setup</name>
            </property>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <inherited>false</inherited>
                    <groupId>org.codehaus.cargo</groupId>
                    <artifactId>cargo-maven2-plugin</artifactId>
                    <configuration>
                        <container>
                            <containerId>wildfly10x</containerId>
                            <zipUrlInstaller>
                                <url>
                                    http://download.jboss.org/wildfly/10.1.0.Final/wildfly-10.1.0.Final.zip
                                </url>
                                <downloadDir>${project.basedir}/cargo/downloads</downloadDir>
                                <extractDir>${project.basedir}/cargo</extractDir>
                            </zipUrlInstaller>
                        </container>
                        <configuration>
                            <properties>
                                <cargo.start.jvmargs>
                                    -Xdebug
                                    -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9000
                                    -Xnoagent
                                    -Djava.compiler=NONE
                                </cargo.start.jvmargs>
                                <cargo.jboss.modules.dir>modules</cargo.jboss.modules.dir>
                                <cargo.servlet.port>9090</cargo.servlet.port>
                                <cargo.jboss.management-http.port>9050</cargo.jboss.management-http.port>
                                <cargo.servlet.users>admin:admin</cargo.servlet.users>
                            </properties>
                        </configuration>
                    </configuration>
                    <executions>
                        <execution>
                            <id>install-cargo</id>
                            <phase>process-test-resources</phase>
                            <goals><goal>install</goal></goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <inherited>false</inherited>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>2.6</version>
                    <executions>
                        <execution>
                            <id>copy-resources-ds</id>
                            <phase>process-test-resources</phase>
                            <goals>
                                <goal>copy-resources</goal>
                            </goals>
                            <configuration>
                                <outputDirectory>${wildfly.home.module}/standalone/configuration</outputDirectory>
                                <resources>
                                    <resource>
                                        <directory>${project.basedir}/src/main/jboss/configuration</directory>
                                        <filtering>false</filtering>
                                    </resource>
                                </resources>
                            </configuration>
                        </execution>
                        <execution>
                            <id>copy-modules-wfly-hsqldb</id>
                            <phase>process-test-resources</phase>
                            <goals>
                                <goal>copy-resources</goal>
                            </goals>
                            <configuration>
                                <outputDirectory>${wildfly.home.module}/modules/system/layers/base/org/hsqldb/main</outputDirectory>
                                <resources>
                                    <resource>
                                        <directory>${project.basedir}/src/main/jboss/modules/org/hsqldb/main</directory>
                                        <filtering>false</filtering>
                                    </resource>
                                </resources>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
    <profile>
        <id>runcargo</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>2.20.1</version>
                    <configuration>
                        <systemPropertyVariables>
                            <jboss.home>${jboss.home}</jboss.home>
                            <module.path>${jboss.home}/modules</module.path>
                        </systemPropertyVariables>
                        <skipITs>${IT.skipTests}</skipITs>
                    </configuration>
                    <executions>
                        <execution>
                            <id>integration-test</id>
                            <goals>
                                <goal>integration-test</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>verify</id>
                            <goals>
                                <goal>verify</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.cargo</groupId>
                    <artifactId>cargo-maven2-plugin</artifactId>
                    <version>1.5.0</version>
                    <configuration>
                        <container>
                            <containerId>wildfly10x</containerId>
                            <zipUrlInstaller>
                                <url>
                                    http://download.jboss.org/wildfly/10.1.0.Final/wildfly-10.1.0.Final.zip
                                </url>
                                <downloadDir>${project.basedir}/cargo/downloads</downloadDir>
                                <extractDir>${project.basedir}/cargo</extractDir>
                            </zipUrlInstaller>
                            <dependencies>
                                <dependency>
                                    <groupId>org.hsqldb</groupId>
                                    <artifactId>hsqldb</artifactId>
                                </dependency>
                            </dependencies>
                        </container>
                        <configuration>
                            <properties>
                                <cargo.start.jvmargs>
                                    -Xdebug
                                    -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9000
                                    -Xnoagent
                                    -Djava.compiler=NONE
                                </cargo.start.jvmargs>
                                <cargo.jboss.modules.dir>modules</cargo.jboss.modules.dir>
                                <cargo.servlet.port>9090</cargo.servlet.port>
                                <cargo.jboss.management-http.port>9050</cargo.jboss.management-http.port>
                                <cargo.servlet.users>admin:admin</cargo.servlet.users>
                            </properties>
                        </configuration>
                    </configuration>
                    <executions>
                        <execution>
                            <id>start-server</id>
                            <phase>pre-integration-test</phase>
                            <goals>
                                <goal>start</goal>
                            </goals>
                            <configuration>
                                <deployables>
                                    <deployable>
                                        <!-- Use exploded deploy: override location to point to the exploded webapp. -->
                                        <location>${project.basedir}/target/${project.artifactId}-${project.version}</location>
                                        <pingURL>http://localhost:9090/javaee-soteria</pingURL>
                                        <pingTimeout>120000</pingTimeout> <!-- 2 min -->
                                        <properties>
                                            <context>javaee-soteria</context>
                                        </properties>
                                    </deployable>
                                </deployables>
                            </configuration>
                        </execution>
                        <execution>
                            <id>stop-server</id>
                            <phase>post-integration-test</phase>
                            <goals>
                                <goal>stop</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

<arquillian ..>
    <container qualifier="wildfly10" default="true">
        <configuration>
            <property name="jbossHome">${jboss.home}</property>
        </configuration>
    </container>
</arquillian>

The exception don't happen if i run container without arquillian.

robyp7
  • 481
  • 2
  • 7
  • 25
  • Resolved: the duplicate layer error you get, doesn't fail your test. it just says that you have some extra duplicate modules root path. Which is fine, but patch manager bit complains about it. Even if that service fails, server still works just fine. so you can safely ignore it. From what it is seen from logs, you have modified default ports of the server, that is why arquillian cannot connect to the server and times out. try adding 9050 to your arquillian.xml โ€“ robyp7 Mar 07 '18 at 13:26
  • If you are starting and stopping the service with cargo then I would change >wildfly-arquillian-container-managed to >wildfly-arquillian-container-managed-remote which is the mode that assumes that the server was started but someone else and not arquillian. โ€“ lordofthejars Mar 08 '18 at 07:02
  • @lordofthejars I solved, I have to set portManager in Arquillian file xml with the port specified in cargo maven plugin. โ€“ robyp7 Mar 16 '18 at 08:04

0 Answers0