On Wed, Oct 11, 2023 at 12:29 AM mlic...@gmail.com <mlich...@gmail.com> wrote: > > Hi > I have this issue occur randomly and wonder how Jackson binds to an XML > writer?
By default underlying Stax implementation to use is detected using Java platform SPI interface. If you do not include specific implementation it will probably use one bundled with JDK which is not as full-featured, reliable or efficient as Woodstox (or Aalto XML). I would recommend adding dependency to Woodstox: https://mvnrepository.com/artifact/com.fasterxml.woodstox/woodstox-core and things will work better. Otherwise it is possible that pretty-printing fails as you have seen. Problem is that with Stax implementations that do not implement Stax2 extensions (like one bundled with JDK) it is not possible to use certain write methods. This is unfortunate flaw in handling which tries to work around the missing Stax2 api but cannot handle all cases. -+ Tatu +- > Caused by: java.lang.UnsupportedOperationException: Not implemented > > at > org.codehaus.stax2.ri.Stax2WriterAdapter.writeRaw(Stax2WriterAdapter.java:419) > ~[!/:4.2.1] > > at > org.codehaus.stax2.ri.Stax2WriterAdapter.writeRaw(Stax2WriterAdapter.java:411) > ~[!/:4.2.1] > > at > com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter$Lf2SpacesIndenter.writeIndentation(DefaultXmlPrettyPrinter.java:532) > ~[!/:2.14.3] > > at > com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter.writeLeafElement(DefaultXmlPrettyPrinter.java:271) > ~[!/:2.14.3] > > at > com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator.writeString(ToXmlGenerator.java:663) > ~[!/:2.14.3] > > at > com.fasterxml.jackson.databind.ser.std.StringSerializer.serialize(StringSerializer.java:41) > ~[!/:2.14.3] > > at > com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:733) > ~[!/:2.14.3] > > at > com.fasterxml.jackson.dataformat.xml.ser.XmlBeanSerializerBase.serializeFields(XmlBeanSerializerBase.java:212) > ~[!/:2.14.3] > > at > com.fasterxml.jackson.dataformat.xml.ser.XmlBeanSerializer.serialize(XmlBeanSerializer.java:129) > ~[!/:2.14.3] > > at > com.fasterxml.jackson.dataformat.xml.ser.XmlSerializerProvider.serializeValue(XmlSerializerProvider.java:108) > ~[!/:2.14.3] > > at > com.fasterxml.jackson.databind.ObjectMapper._writeValueAndClose(ObjectMapper.java:4624) > ~[!/:2.14.3] > > at > com.fasterxml.jackson.databind.ObjectMapper.writeValueAsString(ObjectMapper.java:3869) > ~[!/:2.14.3] > > -- > You received this message because you are subscribed to the Google Groups > "jackson-user" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to jackson-user+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jackson-user/9993cf25-a59a-44ae-84cf-3646bcfe50bdn%40googlegroups.com. -- You received this message because you are subscribed to the Google Groups "jackson-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to jackson-user+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jackson-user/CAL4a10i35A_f6w22g5G%3D638M2JHcu9fA0%2BqUYFUs1bbgyhYzkA%40mail.gmail.com.