Ville Myrskyneva
Ville Myrskyneva

Reputation: 1640

Arquillian: Could not setup GlassFish Embedded Bootstrap

I have created a JPA test with arquillian (1.1.2 final) using embedded Glassfish (3.1.2) and a test using EJBContainer in the same project. I can run the test one by one in Eclipse (Kepler) just fine (when I have a Derby running on background), but when I try to run the tests with maven

'mvn clean test'

I get the error:

Could not setup GlassFish Embedded Bootstrap

From the surefire logs I find this line:

Caused by: org.glassfish.embeddable.GlassFishException: Already bootstrapped

Now, if I comment out the test setting up the EJBContainer, I can run the Arquillian test fine with maven.

The question is, how can I make the the two test classes run "independent" of each other so that the Arquillian will not crumble down because of the embedded-container created with EJBContainer?

I have already tried closing the EJBContainer in @AfterClass method in the test class creating it.

Upvotes: 3

Views: 850

Answers (1)

Apostolos Emmanouilidis
Apostolos Emmanouilidis

Reputation: 7197

Have you tried to create separate executions in maven-surefire-plugin configuration? One execution for test classes using EJBContainer and one for those using Glassfish.

<plugin>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
        <includes>
            <include>**/ejbcontainer/*TestCase*</include>
        </includes>
    </configuration>
    <executions>
        <execution>
            <id>glassfish</id>
            <goals>
                <goal>test</goal>
            </goals>
            <phase>test</phase>
            <configuration>
                <includes>
                    <include>**/glassfish/*TestCase*</include>
                </includes>
            </configuration>
        </execution>
    </executions>
</plugin>

Upvotes: 1

Related Questions