Home  >  Forum  >  Spring
Post New Query

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



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



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








©2019 concretepage.com | Privacy Policy | Contact Us