gpt4 book ai didi

maven - 异常: Multiple service implementations found for interface DeployableContainer when running Arquillian tests

转载 作者:行者123 更新时间:2023-12-03 02:04:06 25 4
gpt4 key购买 nike

我正在尝试遵循 Continuous Enterprise Development in Java, ch. 3 中的示例项目“反馈”稍作修改。

我正在使用 IntelliJ Idea 及其 JBoss-Forge 插件,这与使用书中的控制台没有什么不同。

到目前为止,我已经创建了一个具有以下特征的新项目:

  • Java 1.8
  • JEE 7
  • Wildfly 10.1.0.Final
  • JUnit 4.12
  • 阿奎利安 1.1.13.0
  • 休眠
  • Maven 配置文件:arquillian-wildfly-remote

我已按照教程中的每个步骤进行操作,全部使用 IntelliJ 插件:

  • 将 ACCEPT_DEFAULTS 设置为 true
  • 创建了项目
  • 使用 Hibernate 设置持久性
  • 使用 Hibernate 验证器设置验证
  • 已创建实体 FeedbackEntry
  • 搭建用户界面
  • 伪造安装插件 arquillian
  • 使用 Wildfly 远程容器设置 Arquillian
  • 创造了一个 Arquillian
  • 构建并部署应用

所有这些都成功结束,我可以打开用户界面并将一些值存储在数据库中。尝试运行测试时出现问题:我创建了一个 Wildfly Remote Arquillian 容器:

Creating arquillian container

enter image description here

单击“确定”后,这是我得到的堆栈跟踪:

java.lang.RuntimeException: Could not create new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor

at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:166)
at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:103)
at org.jboss.arquillian.test.spi.TestRunnerAdaptorBuilder.build(TestRunnerAdaptorBuilder.java:52)
at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:114)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:162)
... 8 more
Caused by: org.jboss.arquillian.container.impl.ContainerCreationException: Could not create Container arquillian-wildfly-remote
at org.jboss.arquillian.container.impl.LocalContainerRegistry.create(LocalContainerRegistry.java:85)
at org.jboss.arquillian.container.impl.client.container.ContainerRegistryCreator.createRegistry(ContainerRegistryCreator.java:78)
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:96)
at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:103)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:85)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:143)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:114)
at org.jboss.arquillian.core.impl.ManagerImpl.bindAndFire(ManagerImpl.java:263)
at org.jboss.arquillian.core.impl.InstanceImpl.set(InstanceImpl.java:74)
at org.jboss.arquillian.config.impl.extension.ConfigurationRegistrar.loadConfiguration(ConfigurationRegistrar.java:73)
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:96)
at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:103)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:85)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:143)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:114)
at org.jboss.arquillian.core.impl.ManagerImpl.start(ManagerImpl.java:288)
at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.<init>(EventTestRunnerAdaptor.java:63)
... 13 more
Caused by: java.lang.IllegalStateException: Multiple service implementations found for interface org.jboss.arquillian.container.spi.client.container.DeployableContainer. org.jboss.as.arquillian.container.remote.RemoteDeployableContainer, org.arquillian.container.chameleon.ChameleonContainer
at org.jboss.arquillian.core.impl.loadable.ServiceRegistryLoader.onlyOne(ServiceRegistryLoader.java:74)
at org.jboss.arquillian.container.impl.LocalContainerRegistry.create(LocalContainerRegistry.java:76)
... 37 more


Test ignored.

Test ignored.

Process finished with exit code 255

我找了很多地方,只找到this 。不过我不认为我有超过 1 个容器,只有 Wildfly,所以我对此完全一无所知。

Pom 和其他关键文件在这里:https://gist.github.com/josemigallas/a139fc601b022356391fad5b2ec588b0

为什么会失败以及如何解决/解决此问题?

最佳答案

根据我的经验,这可能是 Arquillian 插件或 IDEA Maven 支持的问题,无法激活配置文件。请确保默认情况下已启用 arquillian-wildfly-remote(如果已勾选,则取消勾选并再次勾选:))。还使用常规 JUnit 运行器(而不是 Arquillian 运行器)运行测试。

关于maven - 异常: Multiple service implementations found for interface DeployableContainer when running Arquillian tests,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44278950/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com