2

I set on Windows 7 java_opts -Xmx512M; the file is about 15Mb and fails in XMLParsing - I am executing from from the command terminal (it times out also in groovyConsole) Short version of the same file executes correctly on W 7

BTW Unchanged XML code executes correctly on SunOS 64Bit in 24 sec.

  • can you pls advise what can I do on Windows 7?

Snippet from the code:

import groovy.util.XmlParser
import javax.xml.xpath.*
import groovy.time.*

inpXMLFile='c:/EnvFiles/CCC.xml'

entry=new File("$inpXMLFile")
assert   entry.exists()
println " ... file existence validated"

...

def node= new XmlParser().parse( new File( inpXMLFile ) ) // Line 23 

// .... the rest of the script

Full trace is enclosed:

... file existence validated

    Caught: java.net.ConnectException: Connection timed out: connect
      java.net.ConnectException: Connection timed out: connect
        at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:629)
        at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1291)
        at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:1258)
        at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:260)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1151)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1047)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:960)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:607)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:116)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:488)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:835)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1210)
        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:568)
        at compCurrent.run(compCurrent.groovy:23)
4

1 に答える 1

0

エラーは DTD 要素にアクセスしているようで、大きなファイル サイズとは関係ありません。

java.net.ConnectException: Connection timed out: connect
com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity

次の 2 つのオプションがあります。1. XML ファイル内の DTD 参照とエンティティを削除またはコメント アウトするか、2. XMLParser での DTD と外部エンティティの解析を無効にします。

def parser = new XmlParser()
parser.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false)
parser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false)
于 2012-12-13T03:25:55.627 に答える