File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes [Fatal Error] :-1:-1: Premature end of file. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "[Fatal Error] :-1:-1: Premature end of file." Watch "[Fatal Error] :-1:-1: Premature end of file." New topic

[Fatal Error] :-1:-1: Premature end of file.

Mani Raju
Ranch Hand

Joined: Oct 09, 2012
Posts: 46
I have used below code .

Document document = null;

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
document = db.parse(new File(filePath));
catch(Throwable th)
throw new PlatformCertException(th);

Here, filePath is location of xml file which i need to read and parse.

for this code i am getting below exception.

[Fatal Error] :-1:-1: Premature end of file.

Caused by: org.xml.sax.SAXParseException: Premature end of file.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at javax.xml.parsers.DocumentBuilder.parse(
... 9 more

Even i specified correct xml file path as an argument for that method.

This code was worked earlier in some other server, but i am getting problem in some other server.

Actually i tried all ways but still i didn't find reason.

Could you please help us to solve this issue.

Shashank Gollapudi
Ranch Hand

Joined: Jan 19, 2012
Posts: 33
The xml file that is being read might not be formed correctly, can you try opening the xml file in any xml editor and check ?
I agree. Here's the link:
subject: [Fatal Error] :-1:-1: Premature end of file.
jQuery in Action, 3rd edition