Exception: Multiple service implementations found for interface DeployableContainer when running Arquillian tests

1.1k views Asked by At

I'm trying to follow the example project "Feedback" from Continuous Enterprise Development in Java, ch. 3 with a bit of modification.

I am using IntelliJ Idea and its JBoss-Forge plugin which shouldn't differ from using the console like in the book.

So far I've created a new project with the following characteristics:

  • Java 1.8
  • JEE 7
  • Wildfly 10.1.0.Final
  • JUnit 4.12
  • Arquillian 1.1.13.0
  • Hibernate
  • Maven profile: arquillian-wildfly-remote

I've followed every step from the tutorial, all using the IntelliJ plugin:

  • set ACCEPT_DEFAULTS true
  • created the project
  • set up persistence with Hibernate
  • set up validation with Hibernate validator
  • created entity FeedbackEntry
  • scaffolded the UI
  • forge install-plugin arquillian
  • set up Arquillian with Wildfly remote container
  • created an Arquillian
  • built and deploy the app

All of them ended successfully, I can open the UI and store some values in the DB. The problem comes when trying to run the test: I create an Wildfly Remote Arquillian container:

Creating arquillian container

enter image description here

After clicking OK this is the stacktrace I get:

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

I've searched in many places and I only have found this. However I don't think I have more than 1 container, only Wildfly, so I'm completely clueless about this.

Pom and other key files here: https://gist.github.com/josemigallas/a139fc601b022356391fad5b2ec588b0

Why is this failing and how can I solve/workaround this issue?

2

There are 2 answers

0
bartosz.majsak On

From my experience, it might be an issue with Arquillian Plugin or IDEA Maven support having troubles with activating the profile. Please make sure that arquillian-wildfly-remote is in fact enabled by default (if it's ticked then untick and tick it again :)). Also run the test using regular JUnit runner, not the Arquillian one.

0
lordofthejars On

I think this is a problem when using IntelliJ with Arquillian support. Can you try to run it from CLI?