Joe,

Is this for the default Apache configuration or does this affect ALL Apache
instances?  I have my own instance defined, but it does not have a
ServerRoot directive, do I need to add one to that httpd.conf?  Just trying
to clarify before I screw things up. :-)

Joel R. Cochran
Director of Internet Services
VamaNet.com
(800)480-8810
mailto:webmaster@vamanet.com


> -----Original Message-----
> From: Joe Pluta [mailto:joepluta@PlutaBrothers.com]
> Sent: Tuesday, July 09, 2002 8:12 PM
> To: web400@midrange.com
> Subject: RE: [WEB400] Package cannot find a file...
>
>
> > From: Joel R. Cochran
> >
> > I have no trouble getting my servlets to use classes in my
> > packages, but one
> > of the classes is giving me fits.  In one of the packages,
> I have a class
> > that reads a text file and outputs the text, line by line,
> to a web page.
> > The problem is that no matter where I put the text file the
> class throws
> > this exception:  "FileNotFoundException:No such path or directory".
> >
> > I do this in a stand alone Swing application with no trouble.  In
> > that case,
> > you must put the text file in the same directory as the class
> > that calls the
> > package.  In this case that would be the "classes" directory.
> >
> > I have placed the file in myApp, WEB-INF, classes, and the package
> > directory, but it is never found.
> >
> > I have tried accessing it using filename, /filename,
> myApp/filename, and
> > /myApp/filename.
>
> Try the ServerRoot directive in the http.conf file in your
> Apache setup (in
> the IFS in folder QIBM/HTTPA/conf).  That usually does the trick.  For
> standalone Tomcat, it's a little different.
>
> If you can't wade through the configuration files, you can
> use the File
> class to empirically determine what your root directory is.
> Just run the
> following code in a servlet:
>
>       String[] files = { "file", "/slashfile", "./dotfile",
> "/./slashdotfile" };
>
>       out.println("<H4>File paths</H4>");
>
>       out.println("<table border=4>");
>       out.println("
> <tr><th>AbsoluteFile</th><th>AbsolutePath</th><th>CanonicalFil
> e</th><th>Cano
> nicalPath</th></tr>");
>
>       try {
>               for (int i = 0; i < files.length; i++)
>               {
>                       File file = new File(files[i]);
>                       out.println("  <tr><td>" +
>                               file.getAbsoluteFile() + "</td><td>" +
>                               file.getAbsolutePath() + "</td><td>" +
>                               file.getCanonicalFile() + "</td><td>" +
>                               file.getCanonicalPath() + "</td></tr>");
>               }
>       } catch (Exception e1) {}
>
>       out.println("</table>");
>
> It will print out a table of the paths and files for various
> syntaxes of
> file prefixes.
>
> Joe
>
>
> _______________________________________________
> This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
> To post a message email: WEB400@midrange.com
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/cgi-bin/listinfo/web400
> or email: WEB400-request@midrange.com
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/web400.
>


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.