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

Jason Hunter jhunter at xquery.com
Thu Nov 11 09:16:04 PST 2004


http://www.jdom.org/docs/faq.html#a0350

-jh-

Ben Lindahl wrote:

> 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(SmartNodeConfiguration.java:778)
> 
>     at 
> com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.readXml(SmartNodeConfiguration.java:793)
> 
>     at 
> com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getWebXmlConfigDoc(SmartNodeConfiguration.java:603)
> 
>     at 
> com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getConfigFilesElement(SmartNodeConfiguration.java:204)
> 
>     at 
> com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getConfigFileNames(SmartNodeConfiguration.java:223)
> 
>     at 
> com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getConfigFiles(SmartNodeConfiguration.java:264)
> 
>     at 
> com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getPaletteConfigFiles(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:3064)
> 
>     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:3064)
> 
>     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(SmartNodeConfiguration.java:778)
> 
>     at 
> com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.readXml(SmartNodeConfiguration.java:793)
> 
>     at 
> com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getWebXmlConfigDoc(SmartNodeConfiguration.java:603)
> 
>     at 
> com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getConfigFilesElement(SmartNodeConfiguration.java:204) 
> 
> 
>     ... 44 more
> 
> Caused by: java.io.IOException
> 
>     at 
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:593)
> 
>     at org.apache.crimson.parser.Resolver.resolveEntity(Resolver.java:389)
> 
>     at 
> org.apache.crimson.parser.ExternalEntity.getInputSource(ExternalEntity.java:89)
> 
>     at org.apache.crimson.parser.Parser2.pushReader(Parser2.java:3327)
> 
>     at 
> org.apache.crimson.parser.Parser2.externalParameterEntity(Parser2.java:3062)
> 
>     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(SmartNodeConfiguration.java:778)
> 
>     at 
> com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.readXml(SmartNodeConfiguration.java:793)
> 
>     at 
> com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getWebXmlConfigDoc(SmartNodeConfiguration.java:603)
> 
>     at 
> com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getConfigFilesElement(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(HttpURLConnection.java:512)
> 
>     at 
> sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:489)
> 
>     at 
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:617)
> 
>     at 
> sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnection.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:3064)
> 
>     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(SmartNodeConfiguration.java:778)
> 
>     at 
> com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.readXml(SmartNodeConfiguration.java:793)
> 
>     at 
> com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getWebXmlConfigDoc(SmartNodeConfiguration.java:603)
> 
>     at 
> com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getConfigFilesElement(SmartNodeConfiguration.java:204)
> 
>     at 
> com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getConfigFileNames(SmartNodeConfiguration.java:223)
> 
>     at 
> com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getConfigFiles(SmartNodeConfiguration.java:264)
> 
>     at 
> com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getPaletteConfigFiles(SmartNodeConfiguration.java:733) 
> 
> 
>     ... 44 more
> 
> Caused by: java.io.IOException
> 
>     at 
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:593)
> 
>     at org.apache.crimson.parser.Resolver.resolveEntity(Resolver.java:389)
> 
>     at 
> org.apache.crimson.parser.ExternalEntity.getInputSource(ExternalEntity.java:89)
> 
>     at org.apache.crimson.parser.Parser2.pushReader(Parser2.java:3327)
> 
>     at 
> org.apache.crimson.parser.Parser2.externalParameterEntity(Parser2.java:3062)
> 
>     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(SmartNodeConfiguration.java:778)
> 
>     at 
> com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.readXml(SmartNodeConfiguration.java:793)
> 
>     at 
> com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getWebXmlConfigDoc(SmartNodeConfiguration.java:603)
> 
>     at 
> com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getConfigFilesElement(SmartNodeConfiguration.java:204)
> 
>     at 
> com.appiancorp.eclipse.smartnode.SmartNodeConfiguration.getConfigFileNames(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(HttpURLConnection.java:512)
> 
>     at 
> sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:489)
> 
>     at 
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:617)
> 
>     at 
> sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnection.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
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com


More information about the jdom-interest mailing list