Java EE Containers

Overview

In Java EE mode, Pax Exam supports GlassFish and WildFly with the following containers:

Embedded or not?

All Java EE containers are embedded in the sense of running in the same Java VM as the test driver. Pax Exam 3.x had two containers for GlassFish, Embedded and Hybrid,  which only differ in the specific way of embedding the server.

The Embedded GlassFish container is just a thin wrapper around the glassfish-embedded-all artifact which does not support OSGi. You can deploy WAR modules in this container, but you cannot provision OSGi bundles.

The Hybrid GlassFish container embeds an OSGi framework and provisions the GlassFish bundles in this framework. This container does not work with GlassFish 4.x and is no longer supported in Pax Exam 4.x.

Remote Mode

The WildFly Test Containers also support a remote mode, deploying to a server which is assumed to be running in a remote Java VM (but possibly on the same host). This remote mode can be useful when the default embedded mode causes classloader conflicts, e.g. when libraries with a ServletContainerInitializer are visible to the system classloader.

To work with a remote container, set the configuration property pax.exam.<server>.remote.host, where server is one of wildfly80 or wildfly90, matching test container dependency of the current project.

Default Reactor Strategy

For Java EE containers, the default reactor strategy is PerSuite. This is because most embedded server implementations do not permit to cleanly shutdown and restart the server in the same process.

Test classes should not override the default.