如何解释javax.xml.bind.UnmarshalException

时间:2013-09-09 20:05:56

标签: java spring jaxb xsd unmarshalling

当我尝试将xml文件转换为java对应文件时,我收到此错误:

09.09.2013 13:58:26 ERROR [manager.getContentsUnmarshalled():154] There was an error parsing the file: "props.xml". JAXB unmarshalling exception; nested exception is javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"newImageOverlay"). Expected elements are <{}GenericData>,<{}VirtualComponent>,<{}application_constants>,<{}channel>

我认为此错误表示xml文件中存在意外元素?

在异常消息中,jaxb如何识别“预期元素”?指定标识符<{}GenericData>,<{}VirtualComponent>,<{}application_constants>,<{}channel>在哪里?

1 个答案:

答案 0 :(得分:0)

我需要将此条目添加到我的应用程序上下文文件中:

<oxm:jaxb2-marshaller>
<oxm:jaxb2-marshaller id="marshaller">
    <oxm:class-to-be-bound name="com.MyGeneratedClass"/>
</oxm:jaxb2-marshaller>
相关问题