tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <christopher.d.schu...@comcast.net>
Subject Re: load-on-startup and multiple coyotes
Date Tue, 02 Dec 2003 17:32:21 GMT
Steffen,

> As soon as I start using 2 coyote connectors together with <load-on-startup>
> 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:

     <listener>
         <listener-class>fully.qualified.InitListener</listener-class>
     </listener>

Put this section right before any <servlet> definitions but after any 
<filter> and <filter-mapping> sections you have.

-chris


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message