[jdom-interest] JDOMParseException because "External entity not found" when not connected to network

Ben Lindahl ben.lindahl at appiancorp.com
Thu Nov 11 08:13:55 PST 2004


Hi all,

 

I'm using the JDOM SAXBuilder to parse a web.xml file that contains in
the following DOCTYPE a reference to
http://java.sun.com/dtd/web-app_2_3.dtd:

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">

 

When I am not connected to the network, I get a JDOMParseException
because that dtd entity cannot be found.  I am using a SAXBuilder to
build it, and I explicitly turned off validation, but the exception
still occurs.

 

I believe that this should not happen if validation is turned off, but
it does.  If I am wrong in this assumption, I would still appreciate
suggestions to get around this problem.

 

The (long, multiple-times-wrapped) exception follows:

org.jdom.input.JDOMParseException: Error on line 2: External entity not
found: "http://java.sun.com/dtd/web-app_2_3.dtd".

    at org.jdom.input.SAXBuilder.build(SAXBuilder.java:468)

    at org.jdom.input.SAXBuilder.build(SAXBuilder.java:770)

    at
com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.readXml(SmartNod
eConfiguration.java:778)

    at
com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.readXml(SmartNod
eConfiguration.java:793)

    at
com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getWebXmlConfigD
oc(SmartNodeConfiguration.java:603)

    at
com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getConfigFilesEl
ement(SmartNodeConfiguration.java:204)

    at
com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getConfigFileNam
es(SmartNodeConfiguration.java:223)

    at
com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getConfigFiles(S
martNodeConfiguration.java:264)

    at
com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getPaletteConfig
Files(SmartNodeConfiguration.java:733) 

    ... 44 more

Caused by: java.io.IOException

    at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3376)

    at
org.apache.crimson.parser.Parser2.externalParameterEntity(Parser2.java:3
064)

    at
org.apache.crimson.parser.Parser2.maybeDoctypeDecl(Parser2.java:1347)

    at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:656)

    at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)

    at
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)

    at org.jdom.input.SAXBuilder.build(SAXBuilder.java:453)

    ... 84 more

Caused by: java.io.IOException

    at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3376)

    at
org.apache.crimson.parser.Parser2.externalParameterEntity(Parser2.java:3
064)

    at
org.apache.crimson.parser.Parser2.maybeDoctypeDecl(Parser2.java:1347)

    at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:656)

    at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)

    at
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)

    at org.jdom.input.SAXBuilder.build(SAXBuilder.java:453)

    at org.jdom.input.SAXBuilder.build(SAXBuilder.java:770)

    at
com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.readXml(SmartNod
eConfiguration.java:778)

    at
com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.readXml(SmartNod
eConfiguration.java:793)

    at
com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getWebXmlConfigD
oc(SmartNodeConfiguration.java:603)

    at
com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getConfigFilesEl
ement(SmartNodeConfiguration.java:204) 

    ... 44 more

Caused by: java.io.IOException

    at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnec
tion.java:593)

    at
org.apache.crimson.parser.Resolver.resolveEntity(Resolver.java:389)

    at
org.apache.crimson.parser.ExternalEntity.getInputSource(ExternalEntity.j
ava:89)

    at org.apache.crimson.parser.Parser2.pushReader(Parser2.java:3327)

    at
org.apache.crimson.parser.Parser2.externalParameterEntity(Parser2.java:3
062)

    at
org.apache.crimson.parser.Parser2.maybeDoctypeDecl(Parser2.java:1347)

    at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:656)

    at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)

    at
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)

    at org.jdom.input.SAXBuilder.build(SAXBuilder.java:453)

    at org.jdom.input.SAXBuilder.build(SAXBuilder.java:770)

    at
com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.readXml(SmartNod
eConfiguration.java:778)

    at
com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.readXml(SmartNod
eConfiguration.java:793)

    at
com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getWebXmlConfigD
oc(SmartNodeConfiguration.java:603)

    at
com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getConfigFilesEl
ement(SmartNodeConfiguration.java:204) 

    ... 44 more

Caused by: java.net.UnknownHostException: java.sun.com

    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:153)

    at java.net.Socket.connect(Socket.java:452)

    at java.net.Socket.connect(Socket.java:402)

    at sun.net.NetworkClient.doConnect(NetworkClient.java:139)

    at sun.net.www.http.HttpClient.openServer(HttpClient.java:402)

    at sun.net.www.http.HttpClient.openServer(HttpClient.java:618)

    at sun.net.www.http.HttpClient.<init>(HttpClient.java:306)

    at sun.net.www.http.HttpClient.<init>(HttpClient.java:267)

    at sun.net.www.http.HttpClient.New(HttpClient.java:339)

    at sun.net.www.http.HttpClient.New(HttpClient.java:320)

    at sun.net.www.http.HttpClient.New(HttpClient.java:315)

    at
sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnecti
on.java:512)

    at
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.ja
va:489)

    at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnec
tion.java:617)

    at
sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnec
tion.java:1451)

    at java.net.URLConnection.getContentType(URLConnection.java:382)

    at
org.apache.crimson.parser.Resolver.resolveEntity(Resolver.java:388)

    ... 92 more

Caused by: java.io.IOException

    at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3376)

    at
org.apache.crimson.parser.Parser2.externalParameterEntity(Parser2.java:3
064)

    at
org.apache.crimson.parser.Parser2.maybeDoctypeDecl(Parser2.java:1347)

    at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:656)

    at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)

    at
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)

    at org.jdom.input.SAXBuilder.build(SAXBuilder.java:453)

    at org.jdom.input.SAXBuilder.build(SAXBuilder.java:770)

    at
com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.readXml(SmartNod
eConfiguration.java:778)

    at
com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.readXml(SmartNod
eConfiguration.java:793)

    at
com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getWebXmlConfigD
oc(SmartNodeConfiguration.java:603)

    at
com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getConfigFilesEl
ement(SmartNodeConfiguration.java:204)

    at
com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getConfigFileNam
es(SmartNodeConfiguration.java:223)

    at
com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getConfigFiles(S
martNodeConfiguration.java:264)

    at
com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getPaletteConfig
Files(SmartNodeConfiguration.java:733) 

    ... 44 more

Caused by: java.io.IOException

    at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnec
tion.java:593)

    at
org.apache.crimson.parser.Resolver.resolveEntity(Resolver.java:389)

    at
org.apache.crimson.parser.ExternalEntity.getInputSource(ExternalEntity.j
ava:89)

    at org.apache.crimson.parser.Parser2.pushReader(Parser2.java:3327)

    at
org.apache.crimson.parser.Parser2.externalParameterEntity(Parser2.java:3
062)

    at
org.apache.crimson.parser.Parser2.maybeDoctypeDecl(Parser2.java:1347)

    at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:656)

    at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)

    at
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)

    at org.jdom.input.SAXBuilder.build(SAXBuilder.java:453)

    at org.jdom.input.SAXBuilder.build(SAXBuilder.java:770)

    at
com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.readXml(SmartNod
eConfiguration.java:778)

    at
com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.readXml(SmartNod
eConfiguration.java:793)

    at
com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getWebXmlConfigD
oc(SmartNodeConfiguration.java:603)

    at
com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getConfigFilesEl
ement(SmartNodeConfiguration.java:204)

    at
com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getConfigFileNam
es(SmartNodeConfiguration.java:223) 

    ... 44 more

Caused by: java.net.UnknownHostException: java.sun.com

    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:153)

    at java.net.Socket.connect(Socket.java:452)

    at java.net.Socket.connect(Socket.java:402)

    at sun.net.NetworkClient.doConnect(NetworkClient.java:139)

    at sun.net.www.http.HttpClient.openServer(HttpClient.java:402)

    at sun.net.www.http.HttpClient.openServer(HttpClient.java:618)

    at sun.net.www.http.HttpClient.<init>(HttpClient.java:306)

    at sun.net.www.http.HttpClient.<init>(HttpClient.java:267)

    at sun.net.www.http.HttpClient.New(HttpClient.java:339)

    at sun.net.www.http.HttpClient.New(HttpClient.java:320)

    at sun.net.www.http.HttpClient.New(HttpClient.java:315)

    at
sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnecti
on.java:512)

    at
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.ja
va:489)

    at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnec
tion.java:617)

    at
sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnec
tion.java:1451)

    at java.net.URLConnection.getContentType(URLConnection.java:382)

    at
org.apache.crimson.parser.Resolver.resolveEntity(Resolver.java:388)

    ... 92 more

 

 

Thanks.

 

- Ben Lindahl

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.jdom.org/pipermail/jdom-interest/attachments/20041111/65c7fc52/attachment.htm


More information about the jdom-interest mailing list