# Problems with Hibernate ORM + Equinox + Java 11

**URL:** <https://discourse.hibernate.org/t/problems-with-hibernate-orm-equinox-java-11/5184>\
**Category:** Hibernate ORM\
**Created:** [March 15, 2021, 5:32pm UTC](https://discourse.hibernate.org/t/problems-with-hibernate-orm-equinox-java-11/5184 "2021-03-15T17:32:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![peterjeschke](https://avatars.discourse-cdn.com/v4/letter/p/a88e4f/32.png) [@peterjeschke](https://discourse.hibernate.org/u/peterjeschke)\
**Post date:** [March 15, 2021, 5:32pm UTC](https://discourse.hibernate.org/t/problems-with-hibernate-orm-equinox-java-11/5184/1 "2021-03-15T17:32:44Z")

</div>

Hello,

we are using Hibernate ORM with OSGi on the eclipse Equinox platform (that means we use Equinox feature.xml and product definitions for our products). Until now, all our products that required Hibernate used Java 9 (or older), so this hasn’t been a problem. But now I want to update our products to run with Java 11 and I run into issues with `javax.bind.xml`. It’s the old problem that it isn’t part of the JRE anymore - we “fixed” the problem in Java 9 by adding `--add-modules java.xml.bind` but now we need a new solution.

My current solution is the most recommended one: I add jaxb-api, jaxb-core and jaxb-impl as dependencys into my feature. BUT. This alone doesn’t fix the problem - I still have to add `-Djavax.xml.bind.JAXBContextFactory=com.sun.xml.bind.v2.ContextFactory` to my vm arguments (this is okay, but if you have a suggestion so that I can omit that, I’d be grateful).

But to use `com.sun.xml.bind.v2.ContextFactory`, I also have to import the package `com.sun.xml.bind.v2` in my bundle that uses hibernate, because the Hibernate Classloader can’t find the class on its own! This is problematic, because the relation is in no way obvious and a few months from now, the package import might be removed because “obviously” the plugin doesn’t need the import.

Is there a way to make the hibernate classloader able to load the class without this ugly hack?

---

<div class="post-metadata">

**Author:** ![sebersole](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/sebersole/32/16_2.png) [@sebersole](https://discourse.hibernate.org/u/sebersole)\
**Post date:** [March 17, 2021, 12:32pm UTC](https://discourse.hibernate.org/t/problems-with-hibernate-orm-equinox-java-11/5184/2 "2021-03-17T12:32:36Z")

</div>

I think you’d be better off asking this to the OSGi / Equinox community. This is nothing really Hibernate-specific.

Sorry I don’t have a better answer.

Perhaps @brmeyer might have a better answer…

---

<div class="post-metadata">

**Author:** ![Grzegorz\_Grzybek](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/grzegorz_grzybek/32/1441_2.png) [@Grzegorz\_Grzybek](https://discourse.hibernate.org/u/Grzegorz_Grzybek)\
**Post date:** [March 17, 2021, 1:58pm UTC](https://discourse.hibernate.org/t/problems-with-hibernate-orm-equinox-java-11/5184/3 "2021-03-17T13:58:14Z")

</div>

Hello @peterjeschke

I work with Karaf (that can work both with Felix and Equinox) and Red Hat Fuse (which is a supported version of Karaf + multitude of other projects like Camel and CXF).

Fuse itself wasn’t (yet) certified on JDK 11 (there’s a plan to do it for Fuse 7.9 release) and I don’t have a straight answer for you. But I’ll definitely check the JAXB usage in OSGi runtime with JDK11 soon.

The problem you’ve described does’t look related to HIbernate itself - JAXB packages (both the API and implementation) should be available through _system bundle_ and ideally these packages should be listed in `org.osgi.framework.bootdelegation` OSGi framework property.

Did you try running your application on upstream Karaf 4.2.11 or 4.3.0? Remember, that it can be use Equinox as underlying OSGi Core implementation.

regards  
Grzegorz Grzybek
