Java.lang.IllegalStateException: Could not find backup for factory javax.faces.context.FacesContextFactory.
は、依存関係内にJSF APIが存在することが原因です 。サーバーが提供する依存関係アーティファクトを使用する代わりに、Java EEアプリケーションのWARまたはEARに依存関係を提供したいと思っています。これにより、必要な更新に関して柔軟性が向上します(更新を想定)私の経験では、サーバーアーティファクト)。これにより、Payara 4.1.2.181での展開を、Arquillianによって実行された組み込みバージョンと簡単に比較できます。<class-loader delegate="false"/>
に/WEB-INF/glassfish-web.xml
を追加してクラスローディングを制御します。
残念ながら、エラーメッセージは役に立たず、試行錯誤のアプローチでMavenの依存関係を調べて除外をテストする必要があります。 jsf-impl.jar
、javax.faces.jar
、jsf-api.jar
、javaee.jar
など、さまざまな投稿から収集した、試してみる価値のある「通常の容疑者」がいます。
1つのバッキングBeanが"Hello world!"
に対してh:outputLabel
を生成する非常に単純なJSFプロジェクトを考えると、デプロイメントはPayaraで機能しますが、機能テストを備えたArquillianでは機能しません。
@RunWith(Arquillian.class)
@RunAsClient
public class FunctionalIT {
private final static Logger LOGGER = LoggerFactory.getLogger(FunctionalIT.class);
@Deployment(testable = false)
public static Archive<?> createDeployment0() throws TransformerException, XPathExpressionException, ParserConfigurationException, SAXException, IOException {
WebArchive retValue = Maven.configureResolver().workOffline().resolve("richtercloud:arquillian-assertt-statements-web:war:1.0-SNAPSHOT")
.withoutTransitivity().asSingle(WebArchive.class);
ByteArrayOutputStream archiveContentOutputStream = new ByteArrayOutputStream();
retValue.writeTo(archiveContentOutputStream, Formatters.VERBOSE);
LOGGER.info(archiveContentOutputStream.toString());
return retValue;
}
@Drone
private WebDriver browser;
@ArquillianResource
private URL deploymentUrl;
@FindBy(id = "helloWorldLabel")
private WebElement helloWorldLabel;
@Test
public void testAll() {
browser.get(deploymentUrl.toExternalForm()+"/index.xhtml");
LOGGER.info(browser.getPageSource());
new WebDriverWait(browser, 10).until(ExpectedConditions.visibilityOf(helloWorldLabel));
}
}
arquillianの展開が次の理由で失敗したため(機能テストはmaven-failsafe-plugin
で実行されます)
Java.lang.IllegalStateException: Could not find backup for factory javax.faces.context.FacesContextFactory.
at javax.faces.FactoryFinderInstance.getFactory(FactoryFinderInstance.Java:541)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.Java:292)
at javax.faces.webapp.FacesServlet.init(FacesServlet.Java:374)
at org.Apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.Java:1435)
at org.Apache.catalina.core.StandardWrapper.load(StandardWrapper.Java:1243)
at org.Apache.catalina.core.StandardContext.loadOnStartup(StandardContext.Java:5468)
at org.Apache.catalina.core.StandardContext.start(StandardContext.Java:5713)
at com.Sun.enterprise.web.WebModule.start(WebModule.Java:609)
at org.Apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.Java:917)
at org.Apache.catalina.core.ContainerBase.addChild(ContainerBase.Java:900)
at org.Apache.catalina.core.StandardHost.addChild(StandardHost.Java:684)
at com.Sun.enterprise.web.WebContainer.loadWebModule(WebContainer.Java:2057)
at com.Sun.enterprise.web.WebContainer.loadWebModule(WebContainer.Java:1703)
at com.Sun.enterprise.web.WebApplication.start(WebApplication.Java:107)
at org.glassfish.internal.data.EngineRef.start(EngineRef.Java:122)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.Java:294)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.Java:357)
at com.Sun.enterprise.v3.server.ApplicationLifecycle.initialize(ApplicationLifecycle.Java:526)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.Java:510)
at com.Sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.Java:549)
at com.Sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.Java:545)
at Java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.Java:360)
at com.Sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.Java:544)
at com.Sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.Java:575)
at com.Sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.Java:567)
at Java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.Java:360)
at com.Sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.Java:566)
at com.Sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.Java:1474)
at com.Sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.Java:111)
at com.Sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.Java:1856)
at com.Sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.Java:1732)
at com.Sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.Java:134)
at com.Sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.Java:110)
at org.jboss.arquillian.container.glassfish.embedded_3_1.GlassFishContainer.deploy(GlassFishContainer.Java:193)
at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.Java:151)
at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.Java:118)
at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.executeOperation(ContainerDeployController.Java:239)
at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.deploy(ContainerDeployController.Java:118)
at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:62)
at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
at Java.lang.reflect.Method.invoke(Method.Java:498)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.Java:86)
at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.Java:103)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.Java:90)
at org.jboss.arquillian.container.impl.client.container.DeploymentExceptionHandler.verifyExpectedExceptionDuringDeploy(DeploymentExceptionHandler.Java:47)
at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:62)
at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
at Java.lang.reflect.Method.invoke(Method.Java:498)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.Java:86)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.Java:95)
at org.jboss.arquillian.container.impl.client.ContainerDeploymentContextHandler.createDeploymentContext(ContainerDeploymentContextHandler.Java:71)
at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:62)
at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
at Java.lang.reflect.Method.invoke(Method.Java:498)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.Java:86)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.Java:95)
at org.jboss.arquillian.container.impl.client.ContainerDeploymentContextHandler.createContainerContext(ContainerDeploymentContextHandler.Java:54)
at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:62)
at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
at Java.lang.reflect.Method.invoke(Method.Java:498)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.Java:86)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.Java:95)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.Java:133)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.Java:105)
at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.Java:62)
at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$1.perform(ContainerDeployController.Java:92)
at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$1.perform(ContainerDeployController.Java:77)
at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.forEachDeployment(ContainerDeployController.Java:232)
at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.forEachManagedDeployment(ContainerDeployController.Java:212)
at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.deployManaged(ContainerDeployController.Java:77)
at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:62)
at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
at Java.lang.reflect.Method.invoke(Method.Java:498)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.Java:86)
at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.Java:103)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.Java:90)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.Java:133)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.Java:105)
at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.Java:62)
at org.jboss.arquillian.container.test.impl.client.ContainerEventController.execute(ContainerEventController.Java:96)
at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:62)
at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
at Java.lang.reflect.Method.invoke(Method.Java:498)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.Java:86)
at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.Java:103)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.Java:90)
at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.Java:83)
at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:62)
at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
at Java.lang.reflect.Method.invoke(Method.Java:498)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.Java:86)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.Java:95)
at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.Java:69)
at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:62)
at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
at Java.lang.reflect.Method.invoke(Method.Java:498)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.Java:86)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.Java:95)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.Java:133)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.Java:105)
at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.beforeClass(EventTestRunnerAdaptor.Java:80)
at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.Java:179)
at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.Java:384)
at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.Java:54)
at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.Java:193)
at org.junit.runners.ParentRunner.run(ParentRunner.Java:363)
at org.jboss.arquillian.junit.Arquillian.run(Arquillian.Java:148)
at org.Apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.Java:369)
at org.Apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.Java:275)
at org.Apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.Java:239)
at org.Apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.Java:160)
at org.Apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.Java:373)
at org.Apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.Java:334)
at org.Apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.Java:119)
at org.Apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.Java:407)
さて、上記のリンクに一致する依存関係などがないようであるため、上記のリンクで提供されているソリューションを適用できないようです。
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] arquillian-assertt-statements
[INFO] arquillian-assertt-statements-web
[INFO] arquillian-assertt-statements-it
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building arquillian-assertt-statements 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ arquillian-assertt-statements ---
[INFO] richtercloud:arquillian-assertt-statements:pom:1.0-SNAPSHOT
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building arquillian-assertt-statements-web 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ arquillian-assertt-statements-web ---
[INFO] richtercloud:arquillian-assertt-statements-web:war:1.0-SNAPSHOT
[INFO] +- org.primefaces:primefaces:jar:6.1:compile
[INFO] \- javax:javaee-web-api:jar:7.0:provided
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building arquillian-assertt-statements-it 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ arquillian-assertt-statements-it ---
[INFO] richtercloud:arquillian-assertt-statements-it:jar:1.0-SNAPSHOT
[INFO] +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] | +- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] | \- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] +- org.jboss.shrinkwrap.descriptors:shrinkwrap-descriptors-api-javaee:jar:2.0.0:test
[INFO] | \- org.jboss.shrinkwrap.descriptors:shrinkwrap-descriptors-api-base:jar:2.0.0:compile
[INFO] +- org.jboss.arquillian.junit:arquillian-junit-container:jar:1.2.0.Final:test
[INFO] | +- org.jboss.arquillian.test:arquillian-test-api:jar:1.2.0.Final:compile
[INFO] | | \- org.jboss.arquillian.core:arquillian-core-api:jar:1.2.0.Final:compile
[INFO] | +- org.jboss.arquillian.test:arquillian-test-spi:jar:1.2.0.Final:compile
[INFO] | | \- org.jboss.arquillian.core:arquillian-core-spi:jar:1.2.0.Final:compile
[INFO] | +- org.jboss.arquillian.container:arquillian-container-test-api:jar:1.2.0.Final:compile
[INFO] | | \- org.jboss.shrinkwrap:shrinkwrap-api:jar:1.2.6:compile
[INFO] | +- org.jboss.arquillian.container:arquillian-container-test-spi:jar:1.2.0.Final:compile
[INFO] | +- org.jboss.arquillian.core:arquillian-core-impl-base:jar:1.2.0.Final:test
[INFO] | +- org.jboss.arquillian.test:arquillian-test-impl-base:jar:1.2.0.Final:test
[INFO] | +- org.jboss.arquillian.container:arquillian-container-impl-base:jar:1.2.0.Final:test
[INFO] | | +- org.jboss.arquillian.config:arquillian-config-api:jar:1.2.0.Final:compile
[INFO] | | +- org.jboss.arquillian.config:arquillian-config-impl-base:jar:1.2.0.Final:compile
[INFO] | | \- org.jboss.shrinkwrap.descriptors:shrinkwrap-descriptors-spi:jar:2.0.0:compile
[INFO] | +- org.jboss.arquillian.container:arquillian-container-test-impl-base:jar:1.2.0.Final:compile
[INFO] | \- org.jboss.shrinkwrap:shrinkwrap-impl-base:jar:1.2.6:test
[INFO] | \- org.jboss.shrinkwrap:shrinkwrap-spi:jar:1.2.6:test
[INFO] +- org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-depchain:pom:2.2.6:test
[INFO] | +- org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-api:jar:2.2.6:compile
[INFO] | +- org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-spi:jar:2.2.6:test
[INFO] | +- org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-spi-maven:jar:2.2.6:test
[INFO] | +- org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-api-maven-archive:jar:2.2.6:test
[INFO] | +- org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-impl-maven:jar:2.2.6:test
[INFO] | | +- org.Eclipse.aether:aether-api:jar:1.0.0.v20140518:test
[INFO] | | +- org.Eclipse.aether:aether-impl:jar:1.0.0.v20140518:test
[INFO] | | +- org.Eclipse.aether:aether-spi:jar:1.0.0.v20140518:test
[INFO] | | +- org.Eclipse.aether:aether-util:jar:1.0.0.v20140518:test
[INFO] | | +- org.Eclipse.aether:aether-connector-basic:jar:1.0.0.v20140518:test
[INFO] | | +- org.Eclipse.aether:aether-transport-wagon:jar:1.0.0.v20140518:test
[INFO] | | +- org.Apache.maven:maven-aether-provider:jar:3.2.5:test
[INFO] | | +- org.Apache.maven:maven-model:jar:3.2.5:test
[INFO] | | +- org.Apache.maven:maven-model-builder:jar:3.2.5:test
[INFO] | | | \- org.codehaus.plexus:plexus-component-annotations:jar:1.5.5:test
[INFO] | | +- org.Apache.maven:maven-repository-metadata:jar:3.2.5:test
[INFO] | | +- org.Apache.maven:maven-settings:jar:3.2.5:test
[INFO] | | +- org.Apache.maven:maven-settings-builder:jar:3.2.5:test
[INFO] | | +- org.codehaus.plexus:plexus-interpolation:jar:1.21:test
[INFO] | | +- org.codehaus.plexus:plexus-utils:jar:3.0.20:test
[INFO] | | +- org.sonatype.plexus:plexus-sec-dispatcher:jar:1.3:test
[INFO] | | | \- org.sonatype.plexus:plexus-cipher:jar:1.4:test
[INFO] | | +- org.Apache.maven.wagon:wagon-provider-api:jar:2.6:test
[INFO] | | +- org.Apache.maven.wagon:wagon-file:jar:2.6:test
[INFO] | | | \- commons-lang:commons-lang:jar:2.6:test
[INFO] | | \- org.Apache.maven.wagon:wagon-http-lightweight:jar:2.6:test
[INFO] | | \- org.Apache.maven.wagon:wagon-http-shared:jar:2.6:test
[INFO] | \- org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-impl-maven-archive:jar:2.2.6:test
[INFO] | +- org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-spi-maven-archive:jar:2.2.6:test
[INFO] | +- org.Eclipse.sisu:org.Eclipse.sisu.plexus:jar:0.3.0.M1:test
[INFO] | | \- org.Eclipse.sisu:org.Eclipse.sisu.inject:jar:0.3.0.M1:test
[INFO] | \- org.codehaus.plexus:plexus-compiler-javac:jar:2.3:test
[INFO] | \- org.codehaus.plexus:plexus-compiler-api:jar:2.3:test
[INFO] +- org.jboss.arquillian.graphene:graphene-webdriver:pom:2.3.2:test
[INFO] | +- org.jboss.arquillian.graphene:graphene-webdriver-api:jar:2.3.2:test
[INFO] | +- org.jboss.arquillian.graphene:graphene-webdriver-spi:jar:2.3.2:test
[INFO] | +- org.jboss.arquillian.graphene:graphene-webdriver-impl:jar:2.3.2:test
[INFO] | | +- org.jboss.arquillian.extension:arquillian-drone-impl:jar:2.5.0:test
[INFO] | | +- org.jboss.arquillian.extension:arquillian-drone-configuration:jar:2.5.0:test
[INFO] | | +- cglib:cglib-nodep:jar:3.2.5:compile
[INFO] | | \- org.objenesis:objenesis:jar:1.2:compile
[INFO] | \- org.jboss.arquillian.extension:arquillian-drone-webdriver-depchain:pom:2.5.0:test
[INFO] | +- org.jboss.arquillian.extension:arquillian-drone-spi:jar:2.5.0:test
[INFO] | \- org.jboss.arquillian.extension:arquillian-drone-webdriver:jar:2.5.0:test
[INFO] | +- org.arquillian.spacelift:arquillian-spacelift:jar:1.0.2:test
[INFO] | | \- org.arquillian.spacelift:arquillian-spacelift-api:jar:1.0.2:test
[INFO] | +- org.jsoup:jsoup:jar:1.8.3:test
[INFO] | \- org.awaitility:awaitility:jar:3.0.0:test
[INFO] | \- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] +- com.codeborne:phantomjsdriver:jar:1.4.1:compile
[INFO] | +- org.seleniumhq.Selenium:selenium-api:jar:3.9.1:compile
[INFO] | \- org.seleniumhq.Selenium:selenium-remote-driver:jar:3.9.1:compile
[INFO] +- org.seleniumhq.Selenium:htmlunit-driver:jar:2.28:compile
[INFO] | \- org.seleniumhq.Selenium:selenium-support:jar:3.9.1:compile
[INFO] +- net.sourceforge.htmlunit:htmlunit:jar:2.24:compile
[INFO] | +- xalan:xalan:jar:2.7.2:compile
[INFO] | | \- xalan:serializer:jar:2.7.2:compile
[INFO] | +- org.Apache.commons:commons-lang3:jar:3.5:compile
[INFO] | +- org.Apache.httpcomponents:httpclient:jar:4.5.2:compile
[INFO] | +- org.Apache.httpcomponents:httpmime:jar:4.5.2:compile
[INFO] | +- commons-codec:commons-codec:jar:1.10:compile
[INFO] | +- net.sourceforge.htmlunit:htmlunit-core-js:jar:2.23:compile
[INFO] | +- net.sourceforge.htmlunit:neko-htmlunit:jar:2.24:compile
[INFO] | | \- xerces:xercesImpl:jar:2.11.0:compile
[INFO] | | \- xml-apis:xml-apis:jar:1.4.01:compile
[INFO] | +- net.sourceforge.cssparser:cssparser:jar:0.9.21:compile
[INFO] | | \- org.w3c.css:sac:jar:1.3:compile
[INFO] | +- commons-io:commons-io:jar:2.5:compile
[INFO] | +- commons-logging:commons-logging:jar:1.2:compile
[INFO] | \- org.Eclipse.jetty.websocket:websocket-client:jar:9.2.20.v20161216:compile
[INFO] | +- org.Eclipse.jetty:jetty-util:jar:9.2.20.v20161216:compile
[INFO] | +- org.Eclipse.jetty:jetty-io:jar:9.2.20.v20161216:compile
[INFO] | \- org.Eclipse.jetty.websocket:websocket-common:jar:9.2.20.v20161216:compile
[INFO] | \- org.Eclipse.jetty.websocket:websocket-api:jar:9.2.20.v20161216:compile
[INFO] +- org.seleniumhq.Selenium:selenium-Java:jar:3.9.1:compile
[INFO] | +- org.seleniumhq.Selenium:selenium-chrome-driver:jar:3.9.1:compile
[INFO] | +- org.seleniumhq.Selenium:selenium-Edge-driver:jar:3.9.1:compile
[INFO] | +- org.seleniumhq.Selenium:selenium-ie-driver:jar:3.9.1:compile
[INFO] | +- org.seleniumhq.Selenium:selenium-opera-driver:jar:3.9.1:compile
[INFO] | +- org.seleniumhq.Selenium:selenium-safari-driver:jar:3.9.1:compile
[INFO] | +- net.bytebuddy:byte-buddy:jar:1.7.9:compile
[INFO] | +- org.Apache.commons:commons-exec:jar:1.3:compile
[INFO] | +- com.google.code.gson:gson:jar:2.8.2:compile
[INFO] | +- com.google.guava:guava:jar:23.6-jre:compile
[INFO] | | +- com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO] | | +- org.checkerframework:checker-compat-qual:jar:2.0.0:compile
[INFO] | | +- com.google.errorprone:error_prone_annotations:jar:2.1.3:compile
[INFO] | | +- com.google.j2objc:j2objc-annotations:jar:1.1:compile
[INFO] | | \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.14:compile
[INFO] | +- org.Apache.httpcomponents:httpcore:jar:4.4.6:compile
[INFO] | +- com.squareup.okhttp3:okhttp:jar:3.9.1:compile
[INFO] | \- com.squareup.okio:okio:jar:1.13.0:compile
[INFO] +- org.seleniumhq.Selenium:selenium-firefox-driver:jar:3.9.1:compile
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.9.2:compile
[INFO] +- richtercloud:Selenium-tools:jar:1.0-SNAPSHOT:compile
[INFO] | +- junit:junit:jar:4.12:compile
[INFO] | | \- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] | +- org.Apache.commons:commons-compress:jar:1.11:compile
[INFO] | +- ru.yandex.qatools.ashot:ashot:jar:1.5.3:compile
[INFO] | | \- com.googlecode.lambdaj:lambdaj:jar:2.3.3:compile
[INFO] | | \- org.hamcrest:hamcrest-all:jar:1.1:compile
[INFO] | \- org.junit.jupiter:junit-jupiter-engine:jar:5.0.3:compile
[INFO] | +- org.apiguardian:apiguardian-api:jar:1.0.0:compile
[INFO] | +- org.junit.platform:junit-platform-engine:jar:1.0.3:compile
[INFO] | | +- org.junit.platform:junit-platform-commons:jar:1.0.3:compile
[INFO] | | \- org.opentest4j:opentest4j:jar:1.0.0:compile
[INFO] | \- org.junit.jupiter:junit-jupiter-api:jar:5.0.3:compile
[INFO] +- org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-api-maven:jar:2.2.6:compile
[INFO] +- org.jboss.arquillian.extension:arquillian-drone-api:jar:2.5.0:compile
[INFO] +- org.jboss.arquillian.junit:arquillian-junit-core:jar:1.2.0.Final:compile
[INFO] +- org.jboss.arquillian.container:arquillian-glassfish-embedded-3.1:jar:1.0.2:compile
[INFO] | +- org.jboss.arquillian.container:arquillian-container-spi:jar:1.2.0.Final:compile
[INFO] | +- org.jboss.arquillian.protocol:arquillian-protocol-servlet:jar:1.2.0.Final:compile
[INFO] | +- org.jboss.arquillian.testenricher:arquillian-testenricher-cdi:jar:1.2.0.Final:compile
[INFO] | +- org.jboss.arquillian.testenricher:arquillian-testenricher-ejb:jar:1.2.0.Final:compile
[INFO] | +- org.jboss.arquillian.testenricher:arquillian-testenricher-resource:jar:1.2.0.Final:compile
[INFO] | \- org.jboss.arquillian.testenricher:arquillian-testenricher-initialcontext:jar:1.2.0.Final:compile
[INFO] \- fish.payara.extras:payara-embedded-all:jar:5.0.0.Alpha3:test
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] arquillian-assertt-statements ...................... SUCCESS [ 0.864 s]
[INFO] arquillian-assertt-statements-web .................. SUCCESS [ 0.060 s]
[INFO] arquillian-assertt-statements-it ................... SUCCESS [ 0.904 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.254 s
[INFO] Finished at: 2018-03-05T11:24:55+01:00
[INFO] Final Memory: 17M/303M
[INFO] ------------------------------------------------------------------------
maven-surefire-plugin
2.21.0でテストを実行すると、同じエラーが発生します。この問題は、5.xおよび4.xブランチの最新の組み込みPayara5.182および4.1.2.181でも発生します。
上記のMCVEよりも多くの情報を含まないが、クローンでの実験を容易にするSSCCEは、 https://gitlab.com/krichter/arquillian-assertt-statements および出力例にあります。 https://gitlab.com/krichter/arquillian-assertt-statements/-/jobs/757058 での完全な実行の.
これは追加することで修正されるようです
_<listener>
<listener-class>com.Sun.faces.config.ConfigureListener</listener-class>
</listener>
_
_web-app
_の_web.xml
_セクションに移動します。プロダクションを汚染したくない場合があるため、_web.xml
_を使用して、プログラムでlistener
を挿入できます(たとえば、Arquillian _@Deployment
_メソッドで)。
_@Deployment(testable = false)
public static Archive<?> createDeployment0() throws ParserConfigurationException,
SAXException,
IOException,
XPathExpressionException,
TransformerConfigurationException,
TransformerException {
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
//namespace awareness is necessary in order to avoid an empty
//`xmlns` attribute to be added to the persistence-unit element in
//the output which causes failure of the functional test due to
//`Java.io.IOException: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 108; Deployment descriptor file META-INF/persistence.xml in archive [project1-jar-1.0-SNAPSHOT.jar]. cvc-complex-type.2.4.a: Invalid content was found starting with element 'persistence-unit'. One of '{"http://xmlns.jcp.org/xml/ns/persistence":persistence-unit}' is expected.`
//see
//https://stackoverflow.com/questions/48362284/how-to-avoid-xmlns-to-be-added-to-a-manipulated-xml-root-element
//for details and an explanation
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document webXmlDocument = documentBuilder.parse(new File("src/main/webapp/WEB-INF/web.xml"));
XPathFactory xPathfactory = XPathFactory.newInstance();
XPath xPath = xPathfactory.newXPath();
XPathExpression expr = xPath.compile("//*[local-name()='web-app']");
Node webAppNode = (Node) expr.evaluate(webXmlDocument,
XPathConstants.NODE);
Element listenerNode = webXmlDocument.createElementNS(webAppNode.getNamespaceURI(),
"listener");
//use `createElementNS` instead of `createElement` in order to avoid
//empty `xmlns` attribute on the created `listener` element which
//is otherwise added even if the document builder is namespace aware
Element listenerClassNode = webXmlDocument.createElementNS(webAppNode.getNamespaceURI(),
"listener-class");
listenerClassNode.setTextContent("com.Sun.faces.config.ConfigureListener");
listenerNode.appendChild(listenerClassNode);
webAppNode.appendChild(listenerNode);
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer();
StringWriter writer = new StringWriter();
transformer.transform(new DOMSource(webXmlDocument), new StreamResult(writer));
String webXml = writer.toString();
StringAsset webXmlAsset = new StringAsset(webXml);
WebArchive archive = ShrinkWrap.create(WebArchive.class)
.setWebXML(webXmlAsset)
...;
return archive;
}
_
別のプロジェクトで完全なWARアーカイブを使用して機能テストを行う場合は、org.jboss.shrinkwrap.api.Node webXml = mavenArtifact.get("/WEB-INF/web.xml")
を使用し、webXml.getAsset().openStream()
をDocumentBuilder
で解析して_web.xml
_を取得します。上記の例。
Payaraバグレポート1105 で解決策を見つけました。ここで提供されている情報をリンクすると、Payara開発者によるさらなる調査と修正がトリガーされることを願っています。
SSCCEのfix
ブランチに修正を追加しました。