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/12/01 05:39:52 UTC

RE: Multiple Servlet contexts

We have been relying on Turbine for all database connections and
pooling..Hence we wouldl like to stick to that. 

-----Original Message-----
From: news [mailto:news@sea.gmane.org] On Behalf Of Laurie Harper
Sent: Thursday, December 01, 2005 4:00 AM
To: user@struts.apache.org
Subject: Re: Multiple Servlet contexts

Thomas Darimont wrote:
>> 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 :))
>>  
> 
> What about removing the dbconnection.jar from the WEB-INF/lib and putting
it into the %TOMCAT_HOME%/common/lib directory ?
> There it will be found from both WebApps using the same classloader...
static Blocks will then only be executed once (IMHO).
> 
> Kind regards,
> Thomas

Alternatively, you could configure a datasource in Tomcat and have both web
apps look it up, instead of having each app setup its own database
connections.

L.


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


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


Re: Multiple Servlet contexts

Posted by Martin Gainty <mg...@hotmail.com>.
I would look at how borland enterprise server initialises and utilises JDBC 
2.0 connections in a webapp agnostic manner referenced by JNDI at
http://www.borland.com/resources/en/pdf/white_papers/bes_a_guide_to_porting_applications.pdf
(You will note that other AppServers such as WL bind their JDBC 2.0 
connections to specific web applications with target= )
Anyone else?
Martin-

----- Original Message ----- 
From: "Anuradha S.Athreya" <an...@world2web.com>
To: "'Struts Users Mailing List'" <us...@struts.apache.org>; 
<la...@holoweb.net>
Sent: Wednesday, November 30, 2005 11:39 PM
Subject: RE: Multiple Servlet contexts


> We have been relying on Turbine for all database connections and
> pooling..Hence we wouldl like to stick to that.
>
> -----Original Message-----
> From: news [mailto:news@sea.gmane.org] On Behalf Of Laurie Harper
> Sent: Thursday, December 01, 2005 4:00 AM
> To: user@struts.apache.org
> Subject: Re: Multiple Servlet contexts
>
> Thomas Darimont wrote:
>>> 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 :))
>>>
>>
>> What about removing the dbconnection.jar from the WEB-INF/lib and putting
> it into the %TOMCAT_HOME%/common/lib directory ?
>> There it will be found from both WebApps using the same classloader...
> static Blocks will then only be executed once (IMHO).
>>
>> Kind regards,
>> Thomas
>
> Alternatively, you could configure a datasource in Tomcat and have both 
> web
> apps look it up, instead of having each app setup its own database
> connections.
>
> L.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
> 

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