XmlMapper xmlMapper = new XmlMapper();
// Reads from XML and converts to POJO
MyClass mycls = xmlMapper.readValue(data, MyClass.class);
// Reads from POJO and converts to XML
xmlMapper.writeValue(new File("test.xml"), mycls);
The XmlMapper() is throwing exception -
java.lang.NoSuchMethodError: com.fasterxml.jackson.dataformat.xml.XmlMapper.coercionConfigDefaults()Lcom/fasterxml/jackson/databind/cfg/MutableCoercionConfig;
at com.fasterxml.jackson.dataformat.xml.XmlMapper.<init>(XmlMapper.java:176)
at com.fasterxml.jackson.dataformat.xml.XmlMapper.<init>(XmlMapper.java:145)
at com.fasterxml.jackson.dataformat.xml.XmlMapper.<init>(XmlMapper.java:127)
As per the issue#471, it can be resolved if all Jackson components have the same version. But still it is not working. Any clue please ?
I have added below dependencies in pom.xml file -
And added below code to read XML
data
-The XmlMapper() is throwing exception -
As per the issue#471, it can be resolved if all Jackson components have the same version. But still it is not working. Any clue please ?