4
當試圖使用EclipseLink MOXy將某些XML解組爲POJO時,我得到一個FileNotFoundException
,它將查找文檔的DTD作爲相對路徑。在使用EclipseLink解組時忽略DTD MOXy
Exception in thread "main" org.springframework.oxm.UnmarshallingFailureException: JAXB unmarshalling exception; nested exception is javax.xml.bind.UnmarshalException
- with linked exception:
[java.io.FileNotFoundException: C:\Users\deejay\Documents\workspace-sts-3.0.0.RELEASE\moxy-test\ieee_idams_exchange.dtd (The system cannot find the file specified)]
at org.springframework.oxm.jaxb.Jaxb2Marshaller.convertJaxbException(Jaxb2Marshaller.java:761)
at org.springframework.oxm.jaxb.Jaxb2Marshaller.unmarshal(Jaxb2Marshaller.java:682)
at org.springframework.oxm.jaxb.Jaxb2Marshaller.unmarshal(Jaxb2Marshaller.java:665)
at com.mendeley.services.utility.EclipseLinkMarshaller.load(EclipseLinkMarshaller.java:29)
at com.mendeley.MoxyTest.main(MoxyTest.java:31)
我提供「外部化元數據」按this example,所以我不知道爲什麼它甚至需要一個DTD。如果我能夠忽略DTD,或者不嘗試解決它,那會很棒。