You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This has been possible in the past via reflection:
// get xmlBinder field
org.eclipse.persistence.jaxb.JAXBBinder jaxbBinder = (JAXBBinder)binder;
Field f = jaxbBinder.getClass().getDeclaredField("xmlBinder"); //NoSuchFieldException
f.setAccessible(true);
XMLBinder binderImpl = (XMLBinder)f.get(jaxbBinder);
Field f2 = binderImpl.getClass().getDeclaredField("unmarshaller"); //NoSuchFieldException
f2.setAccessible(true);
org.eclipse.persistence.oxm.XMLUnmarshaller u = (XMLUnmarshaller)f2.get(binderImpl);
u.setUnmarshalListener(moxyListener);
// there is also SAXUnmarshaller, which wraps an unmarshaller
Field f3 = binderImpl.getClass().getDeclaredField("saxUnmarshaller"); //NoSuchFieldException
f3.setAccessible(true);
org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller saxUnmarshaller = (SAXUnmarshaller)f3.get(binderImpl);
Field f4 = saxUnmarshaller.getClass().getDeclaredField("xmlUnmarshaller"); //NoSuchFieldException
f4.setAccessible(true);
org.eclipse.persistence.internal.oxm.Unmarshaller u2 = (org.eclipse.persistence.internal.oxm.Unmarshaller)f2.get(binderImpl);
u2.setUnmarshalListener(moxyListener);
but these days is more likely to fail:
java.lang.reflect.InaccessibleObjectException: Unable to make field private org.eclipse.persistence.oxm.XMLBinder org.eclipse.persistence.jaxb.JAXBBinder.xmlBinder accessible: module org.eclipse.persistence.moxy does not "opens org.eclipse.persistence.jaxb" to module org.docx4j.JAXB_MOXy
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178)
at java.base/java.lang.reflect.Field.setAccessible(Field.java:172)
The text was updated successfully, but these errors were encountered:
This has been possible in the past via reflection:
but these days is more likely to fail:
The text was updated successfully, but these errors were encountered: