6

I am getting the following error

"java.util.ServiceConfigurationError: javax.servlet.ServletContainerInitializer: Provider org.omnifaces.ApplicationInitializer not found"

when running Arquillian tests.

I have put the most basic test case I could here: https://www.dropbox.com/s/kou5v8kqs5g4g4m/test.zip?dl=0

Unheilig
  • 15,690
  • 193
  • 65
  • 96
LoneWolf
  • 495
  • 4
  • 17
  • Are you using Arquillian+Maven or Arquillian standalone? The problem at least tells that OmniFaces library is missing in Arquillian's runtime classpath. – BalusC Jun 13 '15 at 23:22
  • I am using Arquillian+Maven, while it seems like a classpath issue, the weird part is that the org.omnifaces.ApplicationInitializer is in the same jar as the META-INF/services/javax.servlet.ServletContainerInitializer, since that service is what is causing the ApplicationInitializer to be loaded. I found the problem and will post the solution soon. – LoneWolf Jun 14 '15 at 12:17

1 Answers1

8

After trying to run a built war and running it on Wildfly standalone, I managed to narrow the problem to Arquillian, after testing Arquillian+Glassfish embedded and running without problems, I figured the issue was Arquillian+Wildfly, some more googling around and I found similar issues that were related to using Wildfly embedded with Arquillian and that Wildfly managed with Arquillian runs well, the reason why I can't really tell seems like some sort of bug, but also seems like general advice on-line to use managed or remote containers for the Arquillian tests instead of the embedded ones.

So the solution is really simple just removed this:

    <dependency>
        <groupId>org.wildfly</groupId>
        <artifactId>wildfly-arquillian-container-embedded</artifactId>
        <version>8.2.0.Final</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.wildfly</groupId>
        <artifactId>wildfly-embedded</artifactId>
        <version>8.2.0.Final</version>
        <scope>provided</scope>
    </dependency>

and added this:

    <dependency>
        <groupId>org.wildfly</groupId>
        <artifactId>wildfly-arquillian-container-managed</artifactId>
        <version>8.2.0.Final</version>
        <scope>test</scope>
    </dependency>

The solution ends up being not using Wildfly embedded with Arquillian, but managed instead.

LoneWolf
  • 495
  • 4
  • 17