Re: load-on-startup and multiple coyotes

2003-12-02 Thread Christopher Schultz
Steffen,

As soon as I start using 2 coyote connectors together with 
tomcat initializes the database pools twice.
Interestingly it keeps initializing things twice even if I add a third
coyote.
In about two minutes, Yoav Shapira is going to tell you this:

"Don't use a servlet to initialize your stuff. Instead, use a 
ContextListener. IT's cleaner, more flexible, and only gets loaded when 
it should get loaded."

I used to have InitServlet-style initialization, but now I use 
ContextListeners.

They're pretty easy: create a new class that implements 
javax.servlet.ServletContextListener.

Once you move your code from your old InitServlet, you have to install 
it into the web.xml file like this:


fully.qualified.InitListener

Put this section right before any  definitions but after any 
 and  sections you have.

-chris

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


RE: load-on-startup and multiple coyotes

2003-12-02 Thread Shapira, Yoav

Howdy,

>As soon as I start using 2 coyote connectors together with startup>
>tomcat initializes the database pools twice.
>Interestingly it keeps initializing things twice even if I add a third
>coyote.

You have one load-on-startup tag for each servlet element in web.xml,
and one servlet element in web.xml for each servlet class, even when you
have multiple connectors in server.xml, right?

Tomcat (4.x) will create an instance of your servlet for every 
tag in web.xml.   Each instance will be initialized, so that may be what
you're seeing.

Yoav Shapira




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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



load-on-startup and multiple coyotes

2003-12-02 Thread SH Solutions
Hi, once again,

after having just solved the welcome-servlet problem (posted separately) I
just run into another problem.
I have 5 distinct servlets while all inherit from a common base class whose
simple purpose is to initialize the applications database pool, read
different configuration files and preload some very important information
from the databse. The servlets base class also takes care of synchronization
and single database pool initialization.

This all works very well as long as I have no  set. It also
works well with no  but instead having only one coyote
connector assigned to the application.
This is were the problem comes in. I need to have 2 coyotes. One for http
and one for https.

As soon as I start using 2 coyote connectors together with 
tomcat initializes the database pools twice.
Interestingly it keeps initializing things twice even if I add a third
coyote.

Anyone any glue so far?
I even don't know where to look for this. Any hint would be welcome.

Thanks,

Steffen


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