tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ursula Pieper <urs...@guitar.rockefeller.edu>
Subject Properties file declaration
Date Tue, 26 Feb 2002 15:09:01 GMT

Hi, 

my servlets need to access a properties file 
(/var/tomcat4/webapps/application/WEB-INF/classes/pro.properties). 

I tried to get the parameter to read properly by adding parameter entries 
at different location. so now:

My server.xml entry looks like this:

<Context path="/application" docBase="application" debug="9" 
reloadable="true">
<Parameter name="CONFIG_FILE" 
value="/var/tomcat4/webapps/application/WEB-INF/classes/pro.properties"
override="false"/>
<param-name>CONFIG_FILE</param-name>
<param-value>/var/tomcat4/webapps/application/WEB-INF/classes/pro.properties
</param-value>
</Context>

and the web.xml:

<display-name>/application</display-name>
<description>application</description>

<context-param>
<param-name>CONFIG_FILE</param-name>
<param-value>/var/tomcat4/webapps/application/WEB-INF/classes/pro.properties
</param-value>
</context-param>

This entry gets recognized at tomcat startup:
in catalina.out: 
XmlMapper: org.apache.catalina.core.StandardContext.addParameter( CONFIG_FILE, 
/var/tomcat4/webapps/application/WEB-INF/classes/pro.properties)

The call for is in the servlet looks like this:

init(ServletConfig config)
throws ServletException
    {
            super.init(config);
        try
        {
             configPrefs = new Properties();
             servletContext = config.getServletContext();
             if ( config.getInitParameter("CONFIG_FILE") == null )
             throw new ServletException( "No CONFIG_FILE param" );
	...


and I am getting the following error message:
javax.servlet.ServletException: No CONFIG_FILE param

Can anybody help me straighten this out?

I am new to this and want to get this application to run. I am just now 
learning java and tomcat, so please excuse my probably trivial question. 

I am running 
Tomcat 4.0.1
jdk1.3.1
on redhat 7.2

Thanks a lot!

Ursula



--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message