You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
com.fasterxml.jackson.databind.JsonMappingException: No element/attribute name specified when trying to output element
Suppressed: com.fasterxml.jackson.core.JsonGenerationException: Trying to write END_DOCUMENT when document has no root (ie. trying to output empty document).
at com.fasterxml.jackson.dataformat.xml.util.StaxUtil.throwAsGenerationException(StaxUtil.java:47)
at com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator.close(ToXmlGenerator.java:1188)
at com.fasterxml.jackson.databind.util.ClassUtil.closeOnFailAndThrowAsIOE(ClassUtil.java:488)
at com.fasterxml.jackson.databind.ObjectWriter._configAndWriteValue(ObjectWriter.java:1122)
... 32 more
Caused by: javax.xml.stream.XMLStreamException: Trying to write END_DOCUMENT when document has no root (ie. trying to output empty document).
at com.ctc.wstx.sw.BaseStreamWriter.throwOutputError(BaseStreamWriter.java:1584)
at com.ctc.wstx.sw.BaseStreamWriter.reportNwfStructure(BaseStreamWriter.java:1613)
at com.ctc.wstx.sw.BaseStreamWriter._finishDocument(BaseStreamWriter.java:1439)
at com.ctc.wstx.sw.BaseStreamWriter.closeCompletely(BaseStreamWriter.java:921)
at com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator.close(ToXmlGenerator.java:1183)
... 34 more
Caused by: java.lang.IllegalStateException: No element/attribute name specified when trying to output element
at com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator.handleMissingName(ToXmlGenerator.java:1218)
at com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator._handleStartObject(ToXmlGenerator.java:533)
at com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator.writeStartObject(ToXmlGenerator.java:509)
at com.fasterxml.jackson.core.base.GeneratorBase.writeStartObject(GeneratorBase.java:286)
at com.fasterxml.jackson.core.JsonGenerator.writeTypePrefix(JsonGenerator.java:1459)
at com.fasterxml.jackson.databind.jsontype.impl.TypeSerializerBase.writeTypePrefix(TypeSerializerBase.java:46)
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeWithType(BeanSerializerBase.java:600)
at com.fasterxml.jackson.dataformat.xml.ser.XmlBeanSerializerBase.serializeWithType(XmlBeanSerializerBase.java:320)
at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializePolymorphic(DefaultSerializerProvider.java:452)
... 34 more
Can you please tell me what is wrong?
The text was updated successfully, but these errors were encountered:
texhnolyzze
changed the title
Exception when serializing with type via mapper.writerFor(type).write(...)
Exception when serializing with type via mapper.writerFor(type).write(...)Mar 22, 2020
texhnolyzze
changed the title
Exception when serializing with type via mapper.writerFor(type).write(...)
Exception when serializing with type via mapper.writerFor(type).write(...)
Mar 22, 2020
Hello again!
We have problems with Jackson (2.97) again (not JSON, but XML). Please, tell me what am I doing wrong. Here is the simple code:
I ommitted getters/setters.
Okay, now I'm doing such simple thing:
And it outputs:
Great!
Now I replaced the last line to:
And I'm getting the error:
Can you please tell me what is wrong?
The text was updated successfully, but these errors were encountered: