You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Peter Bismuti <bi...@cs.fsu.edu> on 2000/05/23 21:46:35 UTC
context initialization parameters not working?!
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??
Thanks!
_____________________________________________________________________
| |
| Pete Bismuti |
| Department of Computer Science |
| Florida State University |
| bismuti@cs.fsu.edu (850) 644-6835 |
|_____________________________________________________________________|
Re: context initialization parameters not working?!
Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
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