Home  >  Forum  >  Spring
Post New Query

Underlying Stax XMLStreamWriter does not implement Stax2 API natively


joined on
January 20,2015
Asked on October 04,2015
I need to resolve following error. 
 
com.fasterxml.jackson.core.JsonGenerationException: Underlying Stax XMLStreamWriter (of type com.sun.xml.internal.stream.writers.XMLStreamWriterImpl) does not implement Stax2 API natively and is missing method 'writeRaw': this breaks functionality such as indentation that relies on it. You need to upgrade to using compliant Stax implementation like Woodstox or Aalto
at com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator._reportUnimplementedStax2(ToXmlGenerator.java:1104)
at com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator.writeRaw(ToXmlGenerator.java:638)
at com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter$Lf2SpacesIndenter.writeIndentation(DefaultXmlPrettyPrinter.java:525)
at com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter.writeStartObject(DefaultXmlPrettyPrinter.java:193)
at com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator.writeStartObject(ToXmlGenerator.java:470)
at com.fasterxml.jackson.dataformat.xml.ser.XmlBeanSerializer.serialize(XmlBeanSerializer.java:115)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serializeContents(IndexedListSerializer.java:119)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:79)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:18)
at com.fasterxml.jackson.dataformat.xml.ser.XmlSerializerProvider.serializeValue(XmlSerializerProvider.java:93)
at com.fasterxml.jackson.databind.ObjectMapper.writeValue(ObjectMapper.java:2384)
at org.springframework.web.servlet.view.json.AbstractJackson2View.writeContent(AbstractJackson2View.java:221
joined on
November 18,2013
Replied on October 04,2015

Read the error message carefully

"You need to upgrade to using compliant Stax implementation like Woodstox or Aalto"

So use woodstox as follows.

gradle

compile 'org.codehaus.woodstox:woodstox-core-asl:4.4.1'


maven

<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>woodstox-core-asl</artifactId>
<version>4.4.1</version>
</dependency>

Write Answer








Copyright ©2017 concretepage.com, all rights reserved |Privacy Policy | Contact Us