Hello Craig!
"Craig R. McClanahan" wrote:
> 
> On Sun, 17 Mar 2002, Lev Assinovsky wrote:
> 
> 
> That's two separate issues.
> 
> First, the JNDI namespace that Tomcat 4 gives you is indeed read only --
> it is populated from resources that are configured in server.xml, as
> described in the Tomcat documentation.  In Tomcat 4.0.x, the default
> connection pool is Tyrex, but you can use the one from DBCP by declaring
> your own "factory" (again, as described in the JNDI HOW-TO docs) class of
> "org.apache.commons.dbcp.BasicDataSourceFactory".
> 

I did this. I and look up in the bean. THe problem is if bean has scope
"session"
connection pool is created for every session.
Seems, we have to have one bean with scope="application".

> this, one answer is to not implement SingleThreadModel (avoiding
> SingleThreadModel is a good idea anyway), but you should also really look
> at doing one-time application initialization in a ServletContextListener
> that was introduced in Servlet 2.3 (and therefore supported in Tomcat 4).
> Basically, you do the following:
> 
> * Create a class that implements javax.servlet.ServletContextListener
> 
> * Register it with an element in your web.xml file:
>     <listener>
>         <listener-class>com.mycompany.mypackage.MyListener</listener-class>
>     </listener>
> 
> * In the contextInitialized() method, do whatever setup
>   you need.  Typically, you will create objects and store
>   them as servlet context attributes.  This method is
>   guaranteed to be called exactly once, before any requests
>   are processed by your application.
> 
> * In the contextDestroyed() method, you can do any cleanup
>   needed at shutdown time.  This method is guaranteed to be
>   called exactly once, after the last request has been processed.
> 
> More info on the servlet related concepts can be found in the Servlet 2.3
> Specification <http://java.sun.com/products/servlet/download.html>, and
> you'll get lots more help on general servlet issues on the TOMCAT-USER
> mailing list.
>

What's the advantage over the bean with the scope=application?
 


Regards, 

-- 
Lev Assinovsky                Peterlink Web
Programmer                    St. Petersburg, Russia
Tel/Fax: +7 812 3275343       197022 ul.Chapigina 7Á
E-mail: [EMAIL PROTECTED]

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

Reply via email to