Thanks Sriram for the suggestion of loading the properties file from
within the servlet. Unfortunately, that would involve changing and
recompiling about 20 or more scripts, since all of them use the properties
file.
I'd really like to do this using the parameter directive (Problem still
described below), also to make it compatible to my collaborator.
Anyone?
Thanks, ursula
|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
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>