I think your problem is that you are trying to use a URI in the constructor
for FileInputStream, and you need to be using a name that makes sense to the
native file system (in NT, for example, that means something like
d:\myservletfiles\xml\students1.xml). There are a number of ways to attack
this: you can have an initialization parameter for your servlet that
specifies a data directory (but you need to understand the file structure of
your server), and append the file name that you get from input to that
string, or you can use something like the Class.getResourceAsStream(String)
method, which will essentially look for the file in the same directory from
which your class was loaded (or a subdirectory from that directory if you so
specify).
Hope this helps.
-- --- Original Message -----
From: kal inuganti < >
To: <[EMAIL PROTECTED]>
Sent: Sunday, November 26, 2000 3:32 AM
Subject: I/O Exception in a JSP as well as a servlet
> Hi all
>
> I am trying to do a simple string match using jsp or servlet. The problem
> arises when my servlet or jsp is unable to locate the XML file that is
parsed
> and then the string match is done. I get an error message as follows :
>
> Error: 500
> Location: /examples/servlet/students1
> Internal Servlet Error:
> java.io.FileNotFoundException: http://24.181.167.18:8080/students.xml (The
> system cannot find the path specified) at
> java.io.FileInputStream.open(Native Method)
>
> I have a method in the servlet class that tries to get a parse an XML
file.
> The code for the parsing is as follows:
>
> String uri = "http://24.181.167.18:8080/students.xml";
> Parser ps = new Parser(uri);
> InputStream is = new FileInputStream(uri);
> Document document = ps.readStream(is);
> is.close();
>
> I assume that here the error occurs. I have the entire code online (in a
> different folder too) if you want to help me. You can look at it at
> http://24.181.167.18/kalyan/students1.java and the xml file students.xml
is in
> the same directory.
>
> I would really appreciate it if some one could help me fix the bug!
>
> Thanks,
> Kalyan
>
>
>
> ____________________________________________________________________
> Get free email and a permanent address at http://www.netaddress.com/?N=1
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets