Jaxb2Marshaller fails to unmarshall in the presence of '&'

Sam Granger

New Member
I am using org.springframework.oxm.jaxb.Jaxb2Marshaller to unmarshall my request xml. The unmarshalling fails because of the presence of '&' (ampersand) in the request even though the encoding is set in the prologue as requestXML - \[code\]<?xml version="1.0" encoding="utf-8"?><createaccountrequest><username>Test&jsongg</username><userpassword>12345</userpassword></createaccountrequest>\[/code\]The exception I get is as below 500 Internal Server Error org.springframework.http.converter.HttpMessageNotReadableException: Could not unmarshal to [class com.marketplace.system.customer.service.component.request.vo.AccountRequestVO]: null; nested exception is javax.xml.bind.UnmarshalException - with linked exception: [org.xml.sax.SAXParseException: The reference to entity "jsongg1h61" must end with the ';' delimiter.] at org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter.readFromSource(Jaxb2RootElementHttpMessageConverter.java:82) ~[spring-web-3.1.0.RELEASE.jar:3.1.0.RELEASE] at org.springframework.http.converter.xml.AbstractXmlHttpMessageConverter.readInternal(AbstractXmlHttpMessageConverter.java:61) ~[spring-web-3.1.0.RELEASE.jar:3.1.0.RELEASE] at org.springframework.http.converter.AbstractHttpMessageConverter.read(AbstractHttpMessageConverter.java:153) ~[spring-web-3.1.0.RELEASE.jar:3.1.0.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.readWithMessageConverters(AbstractMessageConverterMethodArgumentResolver.java:120) ~[spring-webmvc-3.1.0.RELEASE.jar:3.1.0.RELEASE]Any pointers would be a great help.Thanks in advance
 
Back
Top