org.xml.sax.SAXParseException: Premature end of file for *VALID* XML

前端 未结 7 764
梦如初夏
梦如初夏 2020-12-15 02:45

I am getting very strange \"Premature end of file.\" exception for last few days on one of our servers. The same configuration XML works fine on another server. We

相关标签:
7条回答
  • 2020-12-15 03:29

    Are you sure that the XML file is in the correct character encoding? FileReader always uses the platform default encoding, so if the "working" server had a default encoding of (say) ISO-8859-1 and the "problem" server uses UTF-8 you would see this error if the XML contains any non-ASCII characters.

    Does it work if you create the InputSource from a FileInputStream instead of a FileReader?

    0 讨论(0)
提交回复
热议问题