开发者

Unmarshalling with JAXB leads to : javax.xml.bind.UnmarshalException (invalid byte sequence)

Here's my problem : I've written a program that unmarshals an XML file given as input and it turns out that my program works just fine on my development environment BUT this same program will yield the following exception on my client's environment :

javax.xml.bind.UnmarshalException - with linked exception: [java.io.UTFDataForma开发者_StackOverflow社区tException: Invalid byte 2 of 2-byte UTF-8 sequence.]

The XML file given as input to my program is using UTF-8 as encoding type. The Unmarshaller object is using the default encoding type, that is UTF-8, since I did not set any property value to it. Besides, I did not set a schema to the unmarshaller, so, I am not even requesting an XML validation.

Does anyone have any idea or has anyone already ran into the same problem?

Thanks in advance


I have already get this error. I have change my configuration to use ISO-8859-1 encoding : marshaller.setProperty(Marshaller.JAXB_ENCODING, "ISO-8859-1");

i can put UTF-8 strings in the xml flow, it's correctly marshall/unmarshall even if the encoding is not define like ISO-8859-1

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜