org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x0) was found in the element content of the document. at javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(AbstractUnmarshallerImpl.java:315) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.createUnmarshalException(UnmarshallerImpl.java:514) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:215) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:184) at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:137) at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:194)
The LDAP code was throwing an AuthenticationException with a null character (0x0) in the message, when connecting to an Active Directory server:
javax.naming.AuthenticationException: [LDAP: error code 49 - 8009030C: LdapErr:DSID-0C09043E, comment: AcceptSecurityContext error, data 0, vece]
The null character was appearing after "vece" and before the bracket.
The exception message is returned by the REST service as a String field in a JAXB object. Then, when the client attempts to unmarshal the object, it fails since the null character is illegal XML. Actually characters 0-31 are illegal, and possibly others as well. Interesting that it had no problem marshaling the object to XML. So, while JAX-RS annotations do a great job in hiding the REST details, and making it look a bit like RPC, it's definitely not RPC and errors like these remind you of that.
No comments:
Post a Comment