Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

SV: [jdom-interest] UnknownHostException with SAXBuilder

Per Norrman

2004-02-04

Replies:

Meddelande
Hi,
 
When given a File object, SAXBuilder calls File#toURL and then creates an InputSource from that URL, and
hands it over to the XMLReader (the underlying parser).  You can always check that you can open a connection
to this URL, yourself:
 
    configFile.toURL().openStream();
 
/pmn
 
-----Ursprungligt meddelande-----
Från: jdom-interest-admin@jdom.org [mailto:jdom-interest-admin@jdom.org] För Daniel, Gillian
Skickat: den 4 februari 2004 14:12
Till: jdom-interest@jdom.org
Ämne: [jdom-interest] UnknownHostException with SAXBuilder

Hi there,

This is my first post to the JDOM mailing list, as up till now I have experienced no problems using JDOM.  However I have been using weblogic 5/8.1 up until now.

 

I am currently part of a team writing an application which reads in configuration files which are in xml files.  For development purposes we are using Apache Tomcat 5.0.16, with Java Standard Edition 1.4.2.02 and Java Enterprise Edition 1.4

 

When I call SAXBuilder.build on any of the configuration files, I get this error

 

Exception: java.net.UnknownHostException: D

 

Now my file is on my D: drive, in a config folder, and the path to this config folder is in a properties file.  The file path is being read in correctly, as I have added debug in to prove this.  I can create a File from this path and the configuration file name, but when I pass this File into the SAXBuilder.build(myFile)  get the UnknowHostException.  I know it falls over here, as I have debug following this line and this is never output.

 

Here is my code:

 

File configFile = new File(thePath+buildFile);

System.out.println("BuildParsingServiceImpl.getRoot(): configFile “ + configFile.toString());

Document document = builder.build(configFile); System.out.println("BuildParsingServiceImpl.getRoot(): Document Created: ");

 

The result of adding thePath + buildFile is

 

D:\dev\projects\SproV2\web\sentinelpro\WEB-INF\config\node.xml

 

I honestly have no idea what is wrong, I have tried making the File a URL, I have tried adding file: in front of thePath, but still nothing.

 

Can somebody please indicate where I am going wrong?

 

Any help would be greatly appreciated, thank-you for taking the time to read this,

Gillian

©2008 junlu.com - Jax Systems, LLC, U.S.A.