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?