hibernate-orm icon indicating copy to clipboard operation
hibernate-orm copied to clipboard

HHH-13794 Fix ClassCast problem JAXBContext

Open haster opened this issue 5 years ago • 5 comments

  • Use the current (XmlParserHelper) class's classloader to create the root JAXB context, so as to avoid a class cast problem with classes loaded on different classloaders due to jaxb defaulting to the current thread's context classloader.
  • Add more information to the error message in case of a problem related to reading the persistence.xml (So that a non-parsing error also gets shown instead of "message: null").

haster avatar Dec 22 '19 14:12 haster

Could someone have a look at this PR please?

bjansen avatar Jul 28 '20 13:07 bjansen

This exactly solves my problem of using jpamodelgen with JDK 11

robertspee-topicus avatar Jan 25 '21 13:01 robertspee-topicus

Is it possible to get this merged?

BobbyRollof avatar Aug 05 '22 11:08 BobbyRollof

I was just looking into this, but it seems newer Maven and/or Java versions (11 update 9) are not affected anymore. At least I couldn't reproduce the error. Please continue the discussion on https://hibernate.atlassian.net/browse/HHH-13794

beikov avatar Aug 15 '22 07:08 beikov

The problem still exists with Hibernate 6.3.1, JDK17, Maven 3.9.4, Maven Compiler Plugin 3.11.0. I created an up-to-date reproducer, see https://hibernate.atlassian.net/browse/HHH-13794?focusedCommentId=112967

daspilker avatar Sep 22 '23 05:09 daspilker