You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Anuradha S.Athreya" <an...@world2web.com> on 2005/11/30 14:09:47 UTC
Multiple Servlet contexts
Premise:
2 web applications deployed in the same Tomcat container
Each application has a different application context
Both the applications share the same database
For making DB connections...
All database connection related classes - bundled into a jar -
dbconnection.jar
Database connection pooling is maintained using Turbine- Intialisation of
turbine happens here
The jar is made available to both the applications:
WebApplication1 - WEB-INF/lib/dbconnection.jar
WebApplication2 - WEB-INF/lib/dbconnection.jar
Tomcat is started:
WebApplication1 servlet init() is called , which inturn makes a call to the
Initialise turbine
WebApplication2 servlet init() is called , which inturn makes a call to the
Initialise turbine(again!!!!)
Now, When a connection is made to the DB by WebApplication1 , it will get a
connection from the connection pool created by WebApplication1
and When a connection is made to the DB by WebApplication2 , it will get a
connection from the connection pool created by WebApplication2
Problem:
Since both the applications are connecting to the same DB, I would like to
have both the applications served with connections from the same pool.
How can I implement this in the scenario presented above?
P.S : The Struts factor in the above problem is that both my web
applications are struts based :))