决定从提供的JBoss服务器切换到嵌入式服务器,在Arquillian的帮助下运行我们的BDD测试。问题是在部署WAR文件期间,WildFly会抱怨。
这是我直接放置WAR文件时在standalone / deployment目录中产生的错误:
"{
\"WFLYCTL0080: Failed services\" => {\"jboss.deployment.unit.\\\"ota.war\\\".INSTALL\" => \"org.jboss.msc.service.StartException in service jboss.deployment.unit.\\\"ota.war\\\".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment \\\"ota.war\\\"
Caused by: java.util.ServiceConfigurationError: javax.servlet.ServletContainerInitializer: Provider org.atmosphere.cpr.AnnotationScanningServletContainerInitializer not found\"},
\"WFLYCTL0180: Services with missing/unavailable dependencies\" => [
\"jboss.deployment.unit.\\\"ota.war\\\".weld.weldClassIntrospector is missing [jboss.deployment.unit.\\\"ota.war\\\".beanmanager]\",
\"jboss.deployment.unit.\\\"ota.war\\\".batch.environment is missing [jboss.deployment.unit.\\\"ota.war\\\".beanmanager]\"
]}"
我们使用Vaadin作为Web应用程序的框架。 Vaadin罐子里有气氛。
这是使用maven时的堆栈跟踪:
Running com.myCompany.otc.features.events.amendId.AmendIdTest
Handler java.util.logging.ConsoleHandler is not defined
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 27.865 sec <<< FAILURE! - in com.myCompany.otc.features.events.amendId.AmendIdTest
com.myCompany.otc.features.events.amendId.AmendIdTest Time elapsed: 27.864 sec <<< ERROR!
org.jboss.arquillian.container.spi.client.container.DeploymentException: Cannot deploy: ota.war
at org.jboss.as.arquillian.container.ArchiveDeployer.deployInternal(ArchiveDeployer.java:141)
at org.jboss.as.arquillian.container.ArchiveDeployer.deployInternal(ArchiveDeployer.java:121)
at org.jboss.as.arquillian.container.ArchiveDeployer.deploy(ArchiveDeployer.java:83)
at org.jboss.as.arquillian.container.CommonDeployableContainer.deploy(CommonDeployableContainer.java:236)
Caused by: java.lang.Exception: {
"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"ota.war\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"ota.war\".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment \"ota.war\"
Caused by: java.util.ServiceConfigurationError: javax.servlet.ServletContainerInitializer: Provider org.atmosphere.cpr.AnnotationScanningServletContainerInitializer not found"},
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"jboss.deployment.unit.\"ota.war\".batch.environment is missing [jboss.deployment.unit.\"ota.war\".beanmanager]",
"jboss.deployment.unit.\"ota.war\".weld.weldClassIntrospector is missing [jboss.deployment.unit.\"ota.war\".beanmanager]"
]}
at org.jboss.as.controller.client.helpers.standalone.impl.ServerDeploymentPlanResultFuture.getActionResult(ServerDeploymentPlanResultFuture.java:134)
at org.jboss.as.controller.client.helpers.standalone.impl.ServerDeploymentPlanResultFuture.getResultFromNode(ServerDeploymentPlanResultFuture.java:123)
at org.jboss.as.controller.client.helpers.standalone.impl.ServerDeploymentPlanResultFuture.get(ServerDeploymentPlanResultFuture.java:85)
at org.jboss.as.controller.client.helpers.standalone.impl.ServerDeploymentPlanResultFuture.get(ServerDeploymentPlanResultFuture.java:42)
at org.jboss.as.controller.client.helpers.standalone.ServerDeploymentHelper.deploy(ServerDeploymentHelper.java:55)
at org.jboss.as.arquillian.container.ArchiveDeployer.deployInternal(ArchiveDeployer.java:135)
at org.jboss.as.arquillian.container.ArchiveDeployer.deployInternal(ArchiveDeployer.java:121)
at org.jboss.as.arquillian.container.ArchiveDeployer.deploy(ArchiveDeployer.java:83)
at org.jboss.as.arquillian.container.CommonDeployableContainer.deploy(CommonDeployableContainer.java:236)
at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:161)
我的POM:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ota</artifactId>
<groupId>com.myCompany</groupId>
<version>1.0.17-RC-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ota-test</artifactId>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.1.11.Final</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-bom</artifactId>
<version>${vaadin.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>19.0</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.8</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.myCompany</groupId>
<artifactId>ota-vaadin</artifactId>
<version>${project.parent.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.myCompany</groupId>
<artifactId>ota-trade-client</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.18</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.18</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.50.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>2.50.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.cukespace</groupId>
<artifactId>cukespace-core</artifactId>
<version>1.6.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wildfly.arquillian</groupId>
<artifactId>wildfly-arquillian-container-embedded</artifactId>
<version>2.0.0.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-impl-maven</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-push</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiled</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-themes</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-cdi</artifactId>
<version>1.0.3</version>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom2</artifactId>
<version>2.0.6</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-cdi</artifactId>
<version>1.0.3</version>
<exclusions>
<exclusion>
<groupId>com.vaadin.external.google</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<!-- You need the maven dependency plugin to download locally a zip with the server, unless you provide your own, it will download under the /target directory -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>process-test-classes</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-dist</artifactId>
<version>10.0.0.Final</version>
<type>zip</type>
<overWrite>false</overWrite>
<outputDirectory>target</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- Fork every test because it will launch a separate AS instance -->
<forkMode>always</forkMode>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
</systemPropertyVariables>
<redirectTestOutputToFile>false</redirectTestOutputToFile>
</configuration>
</plugin>
</plugins>
</build>