You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Erik Erskine <er...@sundayta.com> on 2002/12/05 15:38:28 UTC

Context parameters not visible after stop/start of webapp

I've got a context /foo defined as follows:

<Context path="/foo" docBase="/path/to/unpacked/war">
   <Parameter name="test" value="12345"/>
</Context>

I'm accessing the parameter like this:

public class FooServlet extends HttpServlet {

   public void doGet(HttpServletRequest req, HttpServletResponse resp)
   throws ServletException, IOException {

     ServletContext sc = getServletContext();
     String str = sc.getInitParameter("test");
   }
}

This works fine when Tomcat is first started, and after reloading an 
application (using the manager).  If I stop and the start the 
application, the "sc.getInitParameter" line above returns null.  Once 
this happens it will continue to return null until I restart Tomcat.

I'm using both Tomcat 4.1.12 and 4.1.16beta.  If I specify this as a 
<context-param> in web.xml it works fine, but I don't want to do this as 
I'm passing the name of a configuration file that should be independent 
of the WAR file.

Any ideas?

thanks,

Erik

/--------------------------------------------------------------------\
|   Erik Erskine                                                     |
|   Sundayta Ltd                                                     |
\--------------------------------------------------------------------/


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>