java.util.ServiceConfigurationError when running tests using arquillian+omnifaces

1.2k views Asked by At

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

1

There are 1 answers

0
LoneWolf On BEST ANSWER

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.