Module java.xml does not "opens com.sun.org.apache.xerces.internal.jaxp.datatype" to unnamed module.
Solution
Registering XMLGregorianCalendarAdapter as TypeHierarchyAdapter for XMLGregorianCalendar class
Symptoms
The following exceptions appeared before the fix:
(gson:2.8.9 — default) — java.lang.reflect.InaccessibleObjectException: Unable to make public com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl() accessible: module java.xml does not "exports com.sun.org.apache.xerces.internal.jaxp.datatype" to unnamed module
(gson:2.9.0 — explicitly added dependency) — com.google.gson.JsonIOException: Failed making field 'com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl#eon' accessible; either change its visibility or write a custom TypeAdapter for its declaring type
(gson:2.9.0 — explicitly added dependency) — java.lang.reflect.InaccessibleObjectException: Unable to make field private java.math.BigInteger com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl.eon accessible: module java.xml does not "opens com.sun.org.apache.xerces.internal.jaxp.datatype" to unnamed module
Additional Info
No adding dependency for javax.xml.bind:jaxb-api and com.sun.xml.bind:jaxb-impl required to fix the mentioned problems.
Original cause
Module java.xml does not "opens com.sun.org.apache.xerces.internal.jaxp.datatype" to unnamed module.
Solution
Registering
XMLGregorianCalendarAdapter
as TypeHierarchyAdapter forXMLGregorianCalendar
classSymptoms
The following exceptions appeared before the fix:
java.lang.reflect.InaccessibleObjectException
: Unable to make public com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl() accessible: module java.xml does not "exports com.sun.org.apache.xerces.internal.jaxp.datatype" to unnamed modulecom.google.gson.JsonIOException
: Failed making field 'com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl#eon' accessible; either change its visibility or write a custom TypeAdapter for its declaring typejava.lang.reflect.InaccessibleObjectException
: Unable to make field private java.math.BigInteger com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl.eon accessible: module java.xml does not "opens com.sun.org.apache.xerces.internal.jaxp.datatype" to unnamed moduleAdditional Info
No adding dependency for
javax.xml.bind:jaxb-api
andcom.sun.xml.bind:jaxb-impl
required to fix the mentioned problems.