Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 31592 invoked from network); 14 Dec 2002 01:16:54 -0000 Received: from exchange.sun.com (HELO nagoya.betaversion.org) (192.18.33.10) by daedalus.apache.org with SMTP; 14 Dec 2002 01:16:54 -0000 Received: (qmail 6893 invoked by uid 97); 14 Dec 2002 01:17:51 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@jakarta.apache.org Received: (qmail 6877 invoked by uid 97); 14 Dec 2002 01:17:50 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 6865 invoked by uid 98); 14 Dec 2002 01:17:50 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Message-ID: <20021214011639.81747.qmail@web20810.mail.yahoo.com> Date: Fri, 13 Dec 2002 17:16:39 -0800 (PST) From: aps olute Subject: Re: Cant find a properties file - and shutdowns Tomcat To: Tomcat Users List , Jacob Kjome In-Reply-To: <143265485998.20021213114055@visi.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Thank you for the response. However, I tried one of your solutions already as posted on question #2. Any other ways? --- Jacob Kjome wrote: > Hello aps, > > First, don't use File IO if it isn't necessary (and it isn't here). > Second, see: > http://marc.theaimsgroup.com/?l=tomcat-user&m=103904964313189&w=2 > > Jake > > Friday, December 13, 2002, 11:26:08 AM, you wrote: > > ao> 1) Please help, the support class of my servlet is not able to find the > file > ao> town.xml. I have this file town.xml at taxi/town.xml, a copy at > ao> taxi/WEB-INF/classes/town.xml I tried to pre-pend with "/" and no "/" > with > ao> same results. A snippet of the log is below: > > ao> 81 2002-12-13 01:25:05 StandardContext[/taxi]: Starting filters > ao> 82 2002-12-13 01:25:05 okay it found the file and it exist > ao> 83 Making Javaville from file town.xml > ao> 84 ERROR in opening file town.xml > ao> 85 XmlTree creation failure:/town.xml (No such file or directory) > ao> 86 java.io.FileNotFoundException: /town.xml (No such file or > directory) > ao> 87 at java.io.FileInputStream.open(Native Method) > > ao> Code snippets, on my servlet init() method I have > ao> 18 static String configFileName = "taxisocket.properties"; > ao> 19 static String DEFAULT_XML_FILE = "town.xml"; > ao> ..... > ao> 50 String xmlfile = p.getProperty("xmlfile", > DEFAULT_XML_FILE); > ao> 51 System.out.println("Making Javaville from file " + > xmlfile); > ao> 52 > ao> 53 XmlTree xt = null; > ao> 54 try { > ao> 55 xt = new XmlTree(new File(xmlfile)); > ao> 56 > > ao> on XmlTree.java: > ao> 28 public XmlTree(File f) throws FileNotFoundException, > IOException { > ao> 29 > ao> 30 //open the file > ao> 31 try { > ao> 32 br = new BufferedReader(new FileReader("/"+f)); > ao> 33 } catch (FileNotFoundException fnfe) { > ao> 34 System.err.println("ERROR in opening file " + f); > ao> 35 throw fnfe; > ao> 36 } > > ao> 2) Also if I modify the XmlTree to use the following code, TOMCAT just > ao> shutdowns about a second after starting. Why would this code shutdowns > Tomcat? > ao> This compiles okay and I assume once the servlet calls this at the > init(), it > ao> shuts down Tomcat. > > ao> 33 // force to read a File. > ao> 34 InputStream is = getClass().getResourceAsStream("town.xml"); > ao> 38 br = new BufferedReader(new InputStreamReader(is)); > > ao> aps > > ao> __________________________________________________ > ao> Do you Yahoo!? > ao> Yahoo! Mail Plus - Powerful. Affordable. Sign up now. > ao> http://mailplus.yahoo.com > > ao> -- > ao> To unsubscribe, e-mail: > > ao> For additional commands, e-mail: > > > > > -- > Best regards, > Jacob mailto:hoju@visi.com > > > -- > To unsubscribe, e-mail: > For additional commands, e-mail: > __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- To unsubscribe, e-mail: For additional commands, e-mail: