I am trying to add Hibernate as a dependency of my OSGi bundle using Maven. In my POM file I have:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-osgi</artifactId>
<version>4.3.6.Final</version>
</dependency>
However, when I ran that I got an error:
org.osgi.framework.BundleException: Unresolved constraint in bundle org.hibernate.core [8]: Unable to resolve 8.0: missing requirement [8.0] osgi.wiring.package; (&(osgi.wiring.package=javax.transaction.xa)(version>=1.1.0)(!(version>=2.0.0))) [caused by: Unable to resolve 15.0: missing requirement [15.0] osgi.wiring.package; (osgi.wiring.package=javax.enterprise.context)]
So I added another dependency for javax.enterprise.context:
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<version>1.2</version>
</dependency>
Which solved the previous error but lead to another error:
Auto-properties install: file:///path/to/project/hibernate/target/bundles/javax.inject-1.jar (org.osgi.framework.BundleException: Could not create bundle object. - java.lang.IndexOutOfBoundsException)
And now, I am unable to solve this one or even find out what causes it. I use Apache Felix.