java.util.ServiceConfigurationError when running tests using arquillian+omnifaces
Asked Answered
C

1

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

Cite answered 12/6, 2015 at 20:52 Comment(2)
Are you using Arquillian+Maven or Arquillian standalone? The problem at least tells that OmniFaces library is missing in Arquillian's runtime classpath.Turbid
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.Cite
C
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.

Cite answered 14/6, 2015 at 12:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.