1) Please help, the support class of my servlet is not able to find the file
town.xml. I have this file town.xml at taxi/town.xml, a copy at
taxi/WEB-INF/classes/town.xml I tried to pre-pend with "/" and no "/" with
same results. A snippet of the log is below:
81 2002-12-13 01:25:05 StandardContext[/taxi]: Starting filters
82 2002-12-13 01:25:05 okay it found the file and it exist
83 Making Javaville from file town.xml
84 ERROR in opening file town.xml
85 XmlTree creation failure:/town.xml (No such file or directory)
86 java.io.FileNotFoundException: /town.xml (No such file or directory)
87 at java.io.FileInputStream.open(Native Method)
Code snippets, on my servlet init() method I have
18 static String configFileName = "taxisocket.properties";
19 static String DEFAULT_XML_FILE = "town.xml";
.....
50 String xmlfile = p.getProperty("xmlfile", DEFAULT_XML_FILE);
51 System.out.println("Making Javaville from file " + xmlfile);
52
53 XmlTree xt = null;
54 try {
55 xt = new XmlTree(new File(xmlfile));
56
on XmlTree.java:
28 public XmlTree(File f) throws FileNotFoundException, IOException {
29
30 //open the file
31 try {
32 br = new BufferedReader(new FileReader("/"+f));
33 } catch (FileNotFoundException fnfe) {
34 System.err.println("ERROR in opening file " + f);
35 throw fnfe;
36 }
2) Also if I modify the XmlTree to use the following code, TOMCAT just
shutdowns about a second after starting. Why would this code shutdowns Tomcat?
This compiles okay and I assume once the servlet calls this at the init(), it
shuts down Tomcat.
33 // force to read a File.
34 InputStream is = getClass().getResourceAsStream("town.xml");
38 br = new BufferedReader(new InputStreamReader(is));
aps
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>