0
나는 다음과 코드를 사용하여 :XStream에서 CannotResolveClassException을 throw하는 이유는 무엇입니까?
@XStreamAlias("ListOfMBDO")
public class XMLListOfMBDO {
\t @XStreamImplicit(itemFieldName = "MBDO")
\t public List<ModifyBetriebsortDataObject> items = new LinkedList<ModifyBetriebsortDataObject>();
}
public class ModifyBetriebsortDataObject {
\t @XStreamAlias("PK")
\t public Integer pk;
\t @XStreamAlias("NAME")
\t public String name;
\t public ModifyBetriebsortDataObject(final Integer pk, final String name) {
\t \t this.pk = pk;
\t \t this.name = name;
\t }
}
public void loadThis() {
final String test = "<ListOfMBDO><MBDO><PK>123456</PK><NAME>Test</NAME></MBDO></ListOfMBDO>";
final XStream _xStream = new XStream(new DomDriver());
_xStream.processAnnotations(XMLListOfMBDO.class);
_xStream.processAnnotations(ModifyBetriebsortDataObject.class);
final XMLListOfMBDO testList = (XMLListOfMBDO) _xStream.fromXML(test);
}
Serializationto XML은 잘 작동합니다. 그러나 deserialization 던져
com.thoughtworks.xstream.mapper.CannotResolveClassException: ....data.XMLListOfMBDO : ....data.XMLListOfMBDO
at com.thoughtworks.xstream.mapper.DefaultMapper.realClass(DefaultMapper.java:68)
at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)
at com.thoughtworks.xstream.mapper.DynamicProxyMapper.realClass(DynamicProxyMapper.java:71)
...
왜?