Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 598
LoneWolf Avatar asked Jun 12 '15 20:06

LoneWolf


1 Answers

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.

like image 50
LoneWolf Avatar answered Nov 15 '22 05:11

LoneWolf