在编组我的 Java 代码时:
Marshaller marshaller = context.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshaller.marshal(um, new File("temp.xml"));
我得到了这个例外:
Exception in thread "main" javax.xml.bind.JAXBException: class com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl nor any of its super class is known to this context.
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getBeanInfo(Unknown Source)
at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write(Unknown Source)
at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.marshal(Unknown Source)
at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(Unknown Source)
at App.main(App.java:47)