Calling JAXBContext#newInstance(Class[] classesToBeBound) and JAXBContext#newInstance(Class[] classesToBeBound, Map<String,?> properties ) with classes from java.base as parameters for "classesToBeBound" causes JAXBException, with following description: Package java.lang with JAXB class (class name) defined in a module java.base must be open to at least java.xml.bind module. Generally passing java.base classes to JAXBContext is unnecessary and should be avoided with an exception for using javax.xml.bind.JAXBElement with an array as its root type. Workaround: declare openness propagation for those explicitly with --add-opens For example: --add-opens��java.base/java.lang=java.xml.bind
|