FAQ

See also FAQ for questions related to Pax Exam 2.x.

My test blocks or times out. What can I do?

Make sure that all provisioned bundles are ACTIVE and all required services are registered. To do so, change your configuration to enable an OSGI console. The details of this depend on your OSGi framework.

My test works in the Forked Container but not in the Native Container

With the Native Container, your tests run in the same VM as the Pax Exam driver. Thus, Pax Exam classes and any other classpath dependencies are visible to the system classloader. The OSGi framework may or may try to limit the scope of the parent classloader of bundle classloaders, but even when it does so, bundles in your system under test may thwart the intention of the framework to isolate itself by directly accessing the system classloader.

There is not much Pax Exam can do about this. See the discussion in PAXEXAM-249.

Why does the Java debugger not stop at a breakpoint I set in my Pax Exam JUnit test?

When working with the Forked Container, you are dealing with two Java VM processes, one running the test driver, and one running the OSGi framework. The execution flow of your JUnit class is actually split between the two VMs, and the bodies of your test methods are executed on the remote VM.

So you need to enable remote debugging for the spawned VM using a vmOption() in your @Configuration method, e.g.

vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"),
systemTimeout(0)

Why does Pax Exam ignore my logging configuration?

Pax Exam uses Pax Logging by default. If you have your own logging bundles in your system under test, you may not get what you expect. See Logging Configuration for more details.

How can I provision bundles directly from my IDE workspace?

Use the reference: protocol from Pax URL with the class folder of your IDE.

Why do I get a SecurityException when using Pax Exam with Equinox?

When using Equinox, make sure you don't have org.osgi:org.osgi.core on your classpath at the same time. The Equinox JAR is signed, and the SecurityException is caused by a class with an unexpected checksum being loaded from some other JAR.