tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amos Shapira <amos.shap...@webcollage.com>
Subject RE: Running a servlet on startup
Date Tue, 11 Jul 2000 16:28:44 GMT
Hi,

I think what you have to do is to define a web application which includes
this servlet and assign a <load-on-startup> tag for that servlet in the
context of the web application.  Be aware that this way (which is
supported by the standard of Java Servlets 2.2) may cause your
servlet's init() method to be invoked every time the servlet is loaded
(i.e. if the engine removed the servlet earlier for some reason or
if the servlet is configured under more than one name, or declared
as "single thread model" which will cause multiple instances of it
to be created).

As for the class name question, I think you should give the
plain "full" class name, in your case it would be "myservlet" since
it looks it is in the default Java package (no "package" clause in its
.java file, right?)

Hope this helps,

--Amos Shapira
WebCollage


> -----Original Message-----
> From: ymorahg@gist.com [mailto:ymorahg@gist.com]
> Sent: Tuesday, July 11, 2000 7:26 PM
> To: tomcat-user@jakarta.apache.org
> Subject: Running a servlet on startup
> 
> 
> Hi.
> 
> I want to run a startup servlet to set some global system 
> properties when
> Tomcat starts up. I think I need to add a <ContextInterceptor
> class-"myservlet" /> to my server.xml file. Is this correct?
> 
> Also, if this is correct, if my servlet resides in
> webapps/myservlets/WEB-INF/classes/myservlet.class what do I 
> put for the
> value inside the class="????" I see the example is
> org.apache.tomcat.context.servletname, so what does mine map to?
> 
> Thanks a lot for your help!
> 
> -Yoav
> 
> ---------------------------
> Yoav Morahg
> Software Engineer
> Gist Communications
> (212) 965-1999 xt 122
> ymorahg@gist.com
> 
> 

Mime
View raw message