tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Trevor Porter <>
Subject Why a JNDI URL from getServletConfig().getResource() in Tomcat
Date Fri, 03 Jan 2003 20:33:56 GMT
I'm trying to read in a configuration file I have stored in my /WEB-INF 
directory from my servlet init() using 
getServletConfig().getResource(...) as follows:

public void init() throws ServletException

    String config = getServletConfig().getInitParameter("config");
    URL url = getServletContext().getResource(config);

If I set the config init parameter to something like this (the 
/WEB-INF/test.xml file does exist):


I get back the following jndi URL from getResource():


The same code running under resin returns a file URL as I would expect. 
The problem is that if I replace the getResource() call with a 
getResourceAsStream() under tomcat, the input stream will be empty.  Can 
anyone out there explain this behavior and how to work around it?

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message