On Mon, 24 Sep 2001, Dennis Jay Dole wrote:
> Date: Mon, 24 Sep 2001 21:31:21 -0400
> From: Dennis Jay Dole <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> Subject: RE: Won't read existing file
>
> Yes, good points,...and yet I still have no solution.
> Any other ideas?
>
What's wrong with ServletContext.getResourceAsStream(), or configuring an
absolute path to the directory for your config files? Both suggestions
were explained in my response (quoted below).
Craig
> -----Original Message-----
> From: Vel Periasamy [mailto:[EMAIL PROTECTED]]
> Sent: Monday, September 24, 2001 6:28 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: Won't read existing file
>
>
> Good points. Thanks Craig.
> -Velmurugan Periasamy.
> AEGIS.Net
> http://www.aegis.net
>
>
> -----Original Message-----
> From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
> Sent: Monday, September 24, 2001 6:27 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: Won't read existing file
>
>
>
>
> On Mon, 24 Sep 2001, Vel Periasamy wrote:
>
> > Date: Mon, 24 Sep 2001 17:24:50 -0400
> > From: Vel Periasamy <[EMAIL PROTECTED]>
> > Reply-To: [EMAIL PROTECTED]
> > To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
> > Subject: RE: Won't read existing file
> >
> > Try putting the file into TOMCAT_HOME\bin directory.
> >
>
> This is *not* a portable solution, because it depends on the assumption
> that the current working directory is set here. That's not true for all
> servers (or even all versions of Tomcat).
>
> > BTW, you can create a separate folder to hold the data files and the exact
> > location of this folder can be specified in a properties file. Your
> servlet
> > should read the properties file to get the exact location of the data
> file.
> > This will give you more flexibility if you move the application around.
> >
>
> For read-only access to things in a portable manner, you should use
> ServletContext.getResource() or ServletContext.getResourceAsStream().
> This works, for example, even when your application is run directly from a
> WAR file and there is no such thing as a "real" file for that resource.
>
> For read-write access, the best thing to do is pass the path to a
> configuration directory as a servlet init parameter (or a servlet context
> init parameter, if it is global), and use that to construct absolute paths
> to the required files.
>
> > Hope this helps.
> > -Velmurugan Periasamy.
> > AEGIS.Net
> > http://www.aegis.net
> >
>
> Craig McClanahan
>
>
> >
> >
> > -----Original Message-----
> > From: Dennis Jay Dole [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, September 24, 2001 5:24 PM
> > To: [EMAIL PROTECTED]
> > Subject: Won't read existing file
> >
> >
> > Hi I have a problem...
> > I have a servlet which reads opens a serialized file
> > "File f = new File("Database.scat");"
> > then I do a lot of things when "f.exists()",
> > but since I upgraded my web server to Tomcat (from Sun's old java
> > web-server)
> > it f.exists() returns false even though I know the file is placed in
> > the
> > right
> > directory Tomcat's root directory, and named correctly.
> >
> > Does anyone know why this Tomcat isn't allowing my servlet to open this
> > file? Does it have somthing to do with permissions, or security
> settings?...
> > If so, how do I go about giving permission to my servlet to see the
> database
> > file?
> >
> > Please help!!
> >
> > Dennis Jay Dole
> >
> > [EMAIL PROTECTED]
> >
>
>