Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 28121 invoked from network); 22 Jan 2003 14:27:42 -0000 Received: from exchange.sun.com (192.18.33.10) by 208.185.179.12.available.above.net with SMTP; 22 Jan 2003 14:27:42 -0000 Received: (qmail 13882 invoked by uid 97); 22 Jan 2003 14:28:44 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@jakarta.apache.org Received: (qmail 13866 invoked by uid 97); 22 Jan 2003 14:28:43 -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 13854 invoked by uid 98); 22 Jan 2003 14:28:42 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Message-Id: <5.2.0.9.2.20030122082927.0341f258@shell.visi.com> X-Sender: hoju@shell.visi.com X-Mailer: QUALCOMM Windows Eudora Version 5.2.0.9 Date: Wed, 22 Jan 2003 08:29:59 -0600 To: "Tomcat Users List" From: Jacob Kjome Subject: RE: Opening Files Outside Context In-Reply-To: <484C09F9725FE847AA2C9BCEAB66D7695B088A@SM-GBLO-XM02.emea.w dpr.disney.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=====================_54068156==.ALT" X-Spam-Rating: 208.185.179.12.available.above.net 1.6.2 0/1000/N X-Spam-Rating: 208.185.179.12.available.above.net 1.6.2 0/1000/N --=====================_54068156==.ALT Content-Type: text/plain; charset="us-ascii"; format=flowed I believe it has been discussed before that Java cannot see network drives. Jake At 10:07 AM 1/22/2003 +0000, you wrote: >I know for a fact the path is correct - when I run exactly the same code >with exactly the same file path it works... When I attempt to open the >same file path in Tomcat I get a FileNotFoundException. The path is >networked and on a different drive (h:) from the Tomcat and when I moved >the target file to the same, local drive (c:) it worked. Obviously >either Java cannot see networked drives or some sort of file filter is >in place. Strange... > >-- >Ricardo Gladwell, Java Developer >WD Internet Group, Engineering >[t] (020) 8222 2723 >[m] (07734) 813 187 > > > -----Original Message----- > > From: Dan Tran [mailto:danttran@hotmail.com] > > Sent: 21 January 2003 18:21 > > To: Tomcat Users List > > Subject: Re: Opening Files Outside Context > > > > > > I have no problem opening file outsite my context, > > > > Make sure you have the file path setup correctly > > > > -D > > ----- Original Message ----- > > From: "Erik Price" > > To: "Tomcat Users List" > > Sent: Tuesday, January 21, 2003 9:47 AM > > Subject: Re: Opening Files Outside Context > > > > > > > > > > > > > Gladwell, Ricardo X -ND wrote: > > > > Hi All, > > > > > > > > I have written a JavaBean accessed from a JSP page in Tomcat 4.1 > > > > that opens a file to read from. However, when I open the > > file using > > > > the FileInputStream constructor I get a > > FileNotFoundException. This > > > > method works outside of Tomat on the same machine - the > > file exists, > > > > the path is correct even if it is on a networked drive. > > > > > > > > I assume this is a security feature - the file is outside the > > > > webapps directory. What I would like to know is there anyway of > > > > allowing Tomcat web applications to accessing files outside their > > > > container, either through changing settings in the web.xml or > > > > server.xml files or through the Tomcat admin tool? > > > > > > Did you already try "getServletContext().getResourceAsStream()"? > > > > > > What I have learned (yesterday) is that it is best to register an > > > external file in the web.xml as a ContextParameter and then use > > > getServletContext().getInitParameter() to refer to the file. This > > > forces whoever is deploying your app to make sure that there is in > > > fact a resource available (and provides a means to change > > the path of > > > that resource without going into the code to do so). Just some > > > advice, I suspect you can use getResourceAsStream() without > > consulting > > > the ServletContext for the resource. > > > > > > > > > > > > Erik > > > > > > > > > -- > > > To unsubscribe, e-mail: > > > > > For additional commands, e-mail: > > > > > > > > > -- > > To unsubscribe, e-mail: > > unsubscribe@jakarta.apache.org> > > For > > additional commands, > > e-mail: > > > > > >-- >To unsubscribe, e-mail: >For additional commands, e-mail: --=====================_54068156==.ALT--