DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=27880>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=27880

Cannot open resource URL as stream

           Summary: Cannot open resource URL as stream
           Product: Tomcat 4
           Version: 4.1.30
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: Servlet & JSP API
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


The following two lines of code in a servlet:

java.net.URL url = getServletContext().getResource( "myfile.txt" );
java.io.InputStream input = url.openStream();

throw the following exception:

java.io.FileNotFoundException
        at
org.apache.naming.resources.DirContextURLConnection.getInputStream(DirContextURLConnection.java:344)
        at java.net.URL.openStream(URL.java:913)

The file does exist--when the file "myfile.txt" does not exist,
ServletContext.getResource() returns null.  In the case that the file does exist
the getResource() method returns a URL object but we are then unable to open the
URL as a stream and read from it.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to