Problem with Pax exam and injection

Description

I tried Hibernate 5.2.6 with Pax-Exam 4.9.2 but I found some problem with injection in my junit tests.

My test class :

Option[] options = {
// Provision and launch a container based on a distribution of Karaf (Apache ServiceMix).
karafDistributionConfiguration()
.frameworkUrl(
maven()
.groupId("org.apache.servicemix")
.artifactId("apache-servicemix")
.type("zip")
.version("7.0.0.M3"))
.karafVersion("4.0.7")
.name("Apache ServiceMix")
.unpackDirectory(new File("target/pax"))
.useDeployFolder(false)
.runEmbedded(false),
....
features(maven() <-- internal feature that has a dependency on hibernate-envers

When I try to remove the internal feature, the injection works. After some searching I think that it is the same problem as in this report https://ops4j1.jira.com/browse/PAXEXAM-756.
In shortcut there are more bundles providing injection. One of them comes from the servicemix and another one from the hibernate.

In hibernate-osgi feature xml there is this bundle
<bundle>wrap:mvn:javax.inject/javax.inject/1</bundle>

but maybe this can be replaced with
<bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-atinject_1.0_spec/1.0</bundle>
or with bundle from servicemix.

I tried this replacement and my unit test is working again.

Environment

ServiceMix 7.0.0 M3 - Pax Exam 4.9.2

Assignee

Brett Meyer

Reporter

Jakub Herkel

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure