You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Martin Schmidt <ms...@channel-one.de> on 2001/02/02 14:31:13 UTC
problem with init-param
Hi,
my init-params were set if i enable load-on-startup
(got some System.outs in the init()).
But if i invoke a request, first the init is called
again (hm?) and second the init-params are null!!!
Here's my web.xml (taken from WEB-INF):
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<servlet>
<servlet-name> Init-Test </servlet-name>
<servlet-class> test </servlet-class>
<load-on-startup> 10 </load-on-startup>
<init-param>
<param-name> configFile </param-name>
<param-value> /usr/local/myapps/test/test.conf </param-value>
</init-param>
</servlet>
<session-config>
<session-timeout> 30 </session-timeout>
</session-config>
</web-app>
My system consists of 2 linux-pcs (suse 7.0)
one with apache and mod_jk, the other without
apache but with tomcat. This shouldn't matter
(a direct request to tomcat,
like http://tcworker:8080/mytest/servlet/test,
doesn't get the init-params too)
but who knows....
Any suggestions, hints or other helpful statements?
Thanks in advance.
Martin
Re: problem with init-param
Posted by Martin Schmidt <ms...@channel-one.de>.
Thanks Kevin,
shame on me. I guess this is my biggest mistake in the last 2 month.
Maybe i should find a rich woman and stop working/programming ;)
Thanks again.
Martin
Kevin Jones wrote:
>
> You have two instances of the servlet executing. One with the name
> (/servlet/Init-Test) and one without (/servlet/Test)(this is expected).
>
> The firstone gets initialised and the init-params get set. The container
> hjas no info. about the second, apart from the fact that you are calling it
> through /servlet.
>
> Try browsing to http://localhost:8080/mytest/servlet/Init-Test, you should
> get the first instance, init-params and all
RE: problem with init-param
Posted by Kevin Jones <ke...@develop.com>.
You have two instances of the servlet executing. One with the name
(/servlet/Init-Test) and one without (/servlet/Test)(this is expected).
The firstone gets initialised and the init-params get set. The container
hjas no info. about the second, apart from the fact that you are calling it
through /servlet.
Try browsing to http://localhost:8080/mytest/servlet/Init-Test, you should
get the first instance, init-params and all
Kevin Jones
DevelopMentor
www.develop.com
> -----Original Message-----
> From: ms [mailto:ms]On Behalf Of Martin Schmidt
> Sent: 02 February 2001 13:31
> To: tomcat-user@jakarta.apache.org
> Subject: problem with init-param
>
>
> Hi,
>
> my init-params were set if i enable load-on-startup
> (got some System.outs in the init()).
>
> But if i invoke a request, first the init is called
> again (hm?) and second the init-params are null!!!
>
> Here's my web.xml (taken from WEB-INF):
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <!DOCTYPE web-app
> PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
> "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
>
> <web-app>
> <servlet>
> <servlet-name> Init-Test </servlet-name>
> <servlet-class> test </servlet-class>
> <load-on-startup> 10 </load-on-startup>
> <init-param>
> <param-name> configFile </param-name>
> <param-value> /usr/local/myapps/test/test.conf </param-value>
> </init-param>
> </servlet>
> <session-config>
> <session-timeout> 30 </session-timeout>
> </session-config>
> </web-app>
>
> My system consists of 2 linux-pcs (suse 7.0)
> one with apache and mod_jk, the other without
> apache but with tomcat. This shouldn't matter
> (a direct request to tomcat,
> like http://tcworker:8080/mytest/servlet/test,
> doesn't get the init-params too)
> but who knows....
>
> Any suggestions, hints or other helpful statements?
>
> Thanks in advance.
>
> Martin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, email: tomcat-user-help@jakarta.apache.org