tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <Craig.McClana...@eng.sun.com>
Subject Re: context initialization parameters not working?!
Date Tue, 23 May 2000 19:57:31 GMT
Peter Bismuti wrote:

> I have in my web.xml file:
>
>     <context-param>
>       <param-name>webmaster</param-name>
>       <param-value>peterb@pssg.com</param-value>
>       <description>
>         The EMAIL address of the administrator to whom questions
>         and comments about this application should be addressed.
>       </description>
>     </context-param>
>     <context-param>
>       <param-name>userPropertiesFile</param-name>
>       <param-value>/WEB-INF/user.properties</param-value>
>       <description>
>          This file contains a list users who are allowed
>          to log on as clients
>       </description>
>     </context-param>
>     <context-param>
>       <param-name>adminPropertiesFile</param-name>
>       <param-value>/WEB-INF/admin.properties</param-value>
>       <description>
>          This file contains a list users who are allowed
>          to log on as an administrator.
>       </description>
>     </context-param>
>
> In one of my servlets I have:
>
>    public void init() throws ServletException{
>       // admin password file
>       String adminPropertiesFile  = getInitParameter("adminPropertiesFile");
>       if ((adminPropertiesFile  == null) || (adminPropertiesFile.length() == 0)){
>          throw new UnavailableException(this,"adminPropertiesFile not set");
>       }
>
> when this Servlet is first executed I get this exception thrown (above)
> shown in browser:
>
> Error: 503
>
> Location: /CreditServer/login
>
> adminPropertiesFile not set
>
> Anyone know why this isn't working??
>

What does your getInitParameter() method do?  If you want to retrieve a context
initialization parameter, it should work something like this:

    String adminPropertiesFile =
      (String) getServletContext().getInitParameter("adminPropertiesFile");

>
> Thanks!
>

Craig McClanahan



Mime
View raw message