javax.xml.bind.UnmarshalException: unexpected element (uri:“”, local:“Group”)

前端 未结 14 1133
终归单人心
终归单人心 2020-12-02 10:13
unexpected element (uri:\"\", local:\"Group\"). Expected elements are <{}group>

Meet an exception when unmarshalling from xml



        
相关标签:
14条回答
  • 2020-12-02 11:09

    In case you are going crazy because this happens only in your Tests and you are using PowerMock this is the solution, add it on top of your test class:

    @PowerMockIgnore({ "javax.xml.*", "org.xml.*", "org.w3c.*" })
    
    0 讨论(0)
  • 2020-12-02 11:11

    It looks like your XML document has the root element "Group" instead of "group". You can:

    1. Change the root element on your XML to be "group"
    2. Add the annotation @XmlRootElement(name="Group") to the Group classs.
    0 讨论(0)
提交回复
热议问题