ClassCastException on JAXBContext after upgrading to Java 11

Viewed 1211

After upgrading to Java 11 my PDF generation stop working (using Apache FOP) with the following error.

Caused by: jakarta.xml.bind.JAXBException: ClassCastException: attempting to cast 
  jar:file:jakarta.xml.bind-api-3.0.0.jar!/jakarta/xml/bind/JAXBContext.class to 
  jar:file:jakarta.xml.bind-api-3.0.0.jar!/jakarta/xml/bind/JAXBContext.class.  
Please make sure that you are specifying the proper ClassLoader.

Which make no sense at all since it's the same file. Previous problems solved migrating to jakarta but this remains.

1 Answers

Adding the following dependency solves de issue

<dependency>
  <groupId>org.glassfish.jaxb</groupId>
  <artifactId>jaxb-runtime</artifactId>
  <version>3.0.0</version>
</dependency>
Related