You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Richard Sand <rs...@vgalleries.com> on 2001/06/22 14:37:38 UTC

getResourceAsStream doesn't find files in WEB-INF/classes

Hi- I've deployed an application with Tomcat at the root (i.e. "/").  At one
point I load a resource file with the command:

InputStream is = getClass().getResourceAsStream("/app.properties");

But Tomcat throws an exception here if the file app.properties is in the
/WEB-INF/classes directory.  If I copy it into a directory that is in the
default CLASSPATH, then it works fine.  Isn't the WEB-INF/classes directory
for each deployed application automatically added to the Tomcat classpath?
Is the behavior I'm seeing the expected behavior?

I hope I'm just doing something thick... otherwise, its more problematic to
be able to bundle up an application, because the resource files would need
to be copied somewhere else.  Any advice?

BTW Tomcat 3.2.2 on Win2k, no web server (i.e. Tomcat default, port 8080).

Thanks!

-Richard