With the help of StackOverflow, I’ve understood that there was a dependency conflict between two libs defining the JPA spec 2.0 and 2.1. When running the test the maven dependencies are used to build the test classpath and it contains:

Re: Aries 2.7.0 -> JPA 2.0 or 2.1?

The Aries JPA container is a flexible implementation designed to be used with a variety of JPA providers. It is tested across numerous versions of EclipseLink, Hibernate and OpenJPA. Some of these versions only support JPA 2.0 (OpenJPA only got JPA 2.1 support
in June), as a result it can work with JPA 2.0 or JPA 2.1.

Aries JPA correctly sets up its import ranges so that this can work without problems, however this also relies on the persistence provider (in this case Hibernate) to set up its import ranges appropriately as well. If they haven’t got it quite
right then they can end up being allowed to wire to JPA 2.0 even though that’s not what they should be using.

As Karaf wants to use JPA 2.1 then the sensible thing to do here is to have a Karaf feature which exclude the JPA 2.0 API and only exposes JPA 2.1, which is what they do.

With the help of StackOverflow, I’ve understood that there was a dependency conflict between two libs defining the JPA spec 2.0 and 2.1. When running the test the maven dependencies are used to build the test classpath and it contains: