Home  >  Forum  >  Spring
Post New Query

PropertyException: name: javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT value


joined on
June 15,2014
Asked on March 29,2015
I am creating spring and JAXB application, I am trying for pretty printing of XML and using javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT

Map<String,Object> map = new HashMap<String,Object>();
map.put("javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT", true);
jaxb2Marshaller.setMarshallerProperties(map);

and getting exception as

Caused by: javax.xml.bind.PropertyException: name: javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT value: true
at javax.xml.bind.helpers.AbstractMarshallerImpl.setProperty(AbstractMarshallerImpl.java:358)
at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.setProperty(MarshallerImpl.java:527)
at org.springframework.oxm.jaxb.Jaxb2Marshaller.initJaxbMarshaller(Jaxb2Marshaller.java:711)
at org.springframework.oxm.jaxb.Jaxb2Marshaller.createMarshaller(Jaxb2Marshaller.java:692)
... 4 more
joined on
November 18,2013
Replied on March 29,2015

Use jaxb.formatted.output instead of javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT as

Map<String,Object> map = new HashMap<String,Object>();
map.put("jaxb.formatted.output", true);
jaxb2Marshaller.setMarshallerProperties(map);

Write Answer








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