简体   繁体   English

如何解释javax.xml.bind.UnmarshalException

[英]How to interpret javax.xml.bind.UnmarshalException

I receive this error when i attempt to convert an xml file to its java counterpart : 当我尝试将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>

I think this error is signifying that there is an unexpected element in the xml file ? 我认为此错误表示xml文件中存在意外元素?

In the exception message how is jaxb identifying the "Expected elements" ? 在异常消息中,jaxb如何识别“预期元素”? Where are identifiers <{}GenericData>,<{}VirtualComponent>,<{}application_constants>,<{}channel> specified ? 标识符<{}GenericData>,<{}VirtualComponent>,<{}application_constants>,<{}channel>哪里指定?

I needed to add this entry to my application context file : 我需要将此条目添加到我的应用程序上下文文件中:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM