org.xml.sax.SAXParseException:* VALID * XML的文件过早结束 [英] org.xml.sax.SAXParseException: Premature end of file for *VALID* XML

查看:317
本文介绍了org.xml.sax.SAXParseException:* VALID * XML的文件过早结束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我变得非常奇怪文件过早结束。我们的一台服务器上的最近几天例外。 相同的配置XML在另一台服务器上正常工作。我们在这两台服务器上都使用Tomcat 5.0.28。此代码已经工作了很长时间(7年以上),只有在最近服务器崩溃后,我们才在其中一台服务器上遇到此问题。 XML和Java解析代码没有变化。 :(

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 are using Tomcat 5.0.28 on both these servers. This code has been working for ages (7+ years), only after recent server crash, we faced this problem on one of the servers. There is no change in XML as well as Java parsing code. :(

我能看到的唯一区别是Java版本 -

The only difference I can see is in Java versions -

问题服务器
java版本1.6.0_16
Java(TM)SE运行时环境(版本1.6.0_16-b01)
Java HotSpot(TM)64位服务器VM(版本14.2- b01,混合模式)

Problem Server java version "1.6.0_16" Java(TM) SE Runtime Environment (build 1.6.0_16-b01) Java HotSpot(TM) 64-Bit Server VM (build 14.2-b01, mixed mode)

工作服务器
java版1.6.0_07
Java(TM)SE运行时环境(版本1.6.0_07-b06)
Java HotSpot(TM)64位服务器VM(版本10.0-b23,混合模式)

Working Server java version "1.6.0_07" Java(TM) SE Runtime Environment (build 1.6.0_07-b06) Java HotSpot(TM) 64-Bit Server VM (build 10.0-b23, mixed mode)

这是已经工作了几年的Java代码 -

Here is the Java code that has been working for several years -

private void readSource(final InputSource in ) {
    try {
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        DocumentBuilder db = dbf.newDocumentBuilder();
        Document doc = db.parse(in);
        Element elt = doc.getDocumentElement();

        this.readElement( elt );
    } catch ( Exception ex ) {
        ex.printStackTrace();
        throw new ConfigurationException( "Unable to parse configuration information", ex );
    }
}

这是例外。

[Fatal Error] :-1:-1: Premature end of file.
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 com.circus.core.Configuration.readSource(Configuration.java:706)

我已经尝试过验证XML并发现没有错误那里。知道在哪里可以寻找可能存在的问题吗?

I have already tried validating XML and found no errors there. Any idea where else can I look for possible problem?

任何指针都将受到高度赞赏!

Any pointers would be highly appreciated!

TIA,
- Manish

TIA, - Manish

推荐答案

这已解决。问题出在其他地方。 cron作业中的另一个代码是将XML截断为0长度文件。我照顾好了。

This is resolved. The problem was elsewhere. Another code in cron job was truncating XML to 0 length file. I have taken care of that.

这篇关于org.xml.sax.SAXParseException:* VALID * XML的文件过早结束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆