"Shapira, Yoav" wrote:
> 
> Howdy,
> I'm a bit confused.  Typically, one web app is one context and vice
> versa.  Are you trying to define multiple web-apps per context?
> 
> The ServletContextListener will get messages when a context is
> initialized or destroyed.  So you will get two messages per context for
> the life of the server.  I assume you defined your listener in your
> web.xml?  If so, you should only get one message (the
> contextInitialized() one) when your context is started up.
> 
> The parameter to the ServletContextListener events is a
> ServletContextEvent.  You can call getServletContext() on this, and then
> getServletContextName() will return the context's name.
> 

I was getting null when I called getServletContextName(), since I forgot
to define <display-name> in my web.xml.  After I added it, I see
contextInitialized(event) being called twice. 


> >I have a webapp that i want to load when tomcat starts. I want to make
> >sure the webapp only starts for one webapp and not the others.

yeah, I could go with a servlet, but I'd rather go with
ServletContextListener approach, since it should work. The sentence is
was worded a bit awkward. Basically I will have multple webapps running
in Tomcat. I want to make sure that each webapp loads it's particular
application.

> 
> I don't understand the 2nd sentence above.  Would it be better for your
> needs to abandon the context listener approach in favor of a
> <load-on-startup> servlet in the webapp you want to load on startup, and
> do whatever you need in that servlet's init() method?

going with the servlet approach does provide more control, but it would
be nice to use the context listener method.  I'm guessing it's a bug
with tomcat, since I do get two ContextInitialized(event) events beign
fired.

> 
> Yoav Shapira
> Millennium ChemInformatics
> 

peter

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to