You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2004/03/23 21:19:46 UTC
DO NOT REPLY [Bug 27880] New: -
Cannot open resource URL as stream
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: tomcat-dev@jakarta.apache.org
ReportedBy: rossi+apache@webslingerZ.com
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: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org