Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Connection Pooling and reusing connections on republish of Tomcat webapp within IDE
Connection Pooling and reusing connections on republish of Tomcat webapp within IDE [message #202364] Tue, 16 October 2007 18:58 Go to next message
Steve Whatmore is currently offline Steve WhatmoreFriend
Messages: 95
Registered: July 2009
Member
Good afternoon,

I am experiencing problems with Tomcat and commons-dbcp when my Tomcat
webapp gets restarted / republished from within the IDE.

As far as I can tell the connections in the connection pool are not being
closed when the webapp gets republished.

Has anyone else expierence this problem and is there a work-around?

Thanks in advance.

Whatty
Re: Connection Pooling and reusing connections on republish of Tomcat webapp within IDE [message #202522 is a reply to message #202364] Wed, 17 October 2007 12:42 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1313
Registered: July 2009
Senior Member
I assume by "webapp gets restarted" you referring to what is more
commonly referred to as "reloading". Any reloading triggered by WTP
publishing is under the control of Tomcat and if that's not working, you
may have to resort to restarting the server. I haven't done a lot with
connection pooling, but I believe the easiest way to cause this is to
configure the connection pool as a global resource. Then that pool
would be unaffected by any webapp reloading. Is this the case in your
configuration?

Cheers,
Larry

Steve Whatmore wrote:
> Good afternoon,
>
> I am experiencing problems with Tomcat and commons-dbcp when my Tomcat
> webapp gets restarted / republished from within the IDE.
>
> As far as I can tell the connections in the connection pool are not being
> closed when the webapp gets republished.
>
> Has anyone else expierence this problem and is there a work-around?
>
> Thanks in advance.
>
> Whatty
>
>
Re: Connection Pooling and reusing connections on republish of Tomcat webapp within IDE [message #202546 is a reply to message #202522] Wed, 17 October 2007 15:35 Go to previous messageGo to next message
Steve Whatmore is currently offline Steve WhatmoreFriend
Messages: 95
Registered: July 2009
Member
You are correct, I am in fact referring to reloading.

This is how I have the resource defined

<!-- Connection Pooling Resource Definition -->
<resource-ref>
<description>Data Source Connection Pool</description>
<res-ref-name>jdbc/sybase</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>

and in the context.xml I have the following (some details removed)

<Context>

<!-- Default set of monitored resources -->
<WatchedResource>/WEB-INF/web.xml</WatchedResource>

<Resource
name="jdbc/sybase"
auth="Application"
factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory "
type="javax.sql.DataSource"
driverClassName="com.sybase.jdbc3.jdbc.SybDriver"
.... <etc>
/>

</Context>

Thus, if I can the <res-auth> attribute to the following that should do it
correct?

<res-auth>Container</res-auth>

Whatty

"Larry Isaacs" <Larry.Isaacs@sas.com> wrote in message
news:ff4vvf$7vo$1@build.eclipse.org...
>I assume by "webapp gets restarted" you referring to what is more commonly
>referred to as "reloading". Any reloading triggered by WTP publishing is
>under the control of Tomcat and if that's not working, you may have to
>resort to restarting the server. I haven't done a lot with connection
>pooling, but I believe the easiest way to cause this is to configure the
>connection pool as a global resource. Then that pool would be unaffected
>by any webapp reloading. Is this the case in your configuration?
>
> Cheers,
> Larry
>
> Steve Whatmore wrote:
>> Good afternoon,
>>
>> I am experiencing problems with Tomcat and commons-dbcp when my Tomcat
>> webapp gets restarted / republished from within the IDE.
>>
>> As far as I can tell the connections in the connection pool are not being
>> closed when the webapp gets republished.
>>
>> Has anyone else expierence this problem and is there a work-around?
>>
>> Thanks in advance.
>>
>> Whatty
Re: Connection Pooling and reusing connections on republish of Tomcat webapp within IDE [message #202553 is a reply to message #202546] Wed, 17 October 2007 16:30 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1313
Registered: July 2009
Senior Member
Just to make sure, where is this context.xml located? Also, which
version of WTP and have you changed anything about how the default
server comes configured.

Again, I haven't done a lot with connection pools, but I assume the
closing of connections you are looking for is dependent on the pool
being garbage collected. Even if the pool is being loaded in the
webapp's classloader and not in one of the server's classloaders, the
old webapp classloader can fail to garbage collect for a number of
reasons. Some of these reasons are bugs internal to Tomcat.
Unfortunately, I've lost track of which Tomcat versions fix which issues.

Larry

Steve Whatmore wrote:
> You are correct, I am in fact referring to reloading.
>
> This is how I have the resource defined
>
> <!-- Connection Pooling Resource Definition -->
> <resource-ref>
> <description>Data Source Connection Pool</description>
> <res-ref-name>jdbc/sybase</res-ref-name>
> <res-type>javax.sql.DataSource</res-type>
> <res-auth>Application</res-auth>
> <res-sharing-scope>Shareable</res-sharing-scope>
> </resource-ref>
>
> and in the context.xml I have the following (some details removed)
>
> <Context>
>
> <!-- Default set of monitored resources -->
> <WatchedResource>/WEB-INF/web.xml</WatchedResource>
>
> <Resource
> name="jdbc/sybase"
> auth="Application"
> factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory "
> type="javax.sql.DataSource"
> driverClassName="com.sybase.jdbc3.jdbc.SybDriver"
> .... <etc>
> />
>
> </Context>
>
> Thus, if I can the <res-auth> attribute to the following that should do it
> correct?
>
> <res-auth>Container</res-auth>
>
> Whatty
>
> "Larry Isaacs" <Larry.Isaacs@sas.com> wrote in message
> news:ff4vvf$7vo$1@build.eclipse.org...
>> I assume by "webapp gets restarted" you referring to what is more commonly
>> referred to as "reloading". Any reloading triggered by WTP publishing is
>> under the control of Tomcat and if that's not working, you may have to
>> resort to restarting the server. I haven't done a lot with connection
>> pooling, but I believe the easiest way to cause this is to configure the
>> connection pool as a global resource. Then that pool would be unaffected
>> by any webapp reloading. Is this the case in your configuration?
>>
>> Cheers,
>> Larry
>>
>> Steve Whatmore wrote:
>>> Good afternoon,
>>>
>>> I am experiencing problems with Tomcat and commons-dbcp when my Tomcat
>>> webapp gets restarted / republished from within the IDE.
>>>
>>> As far as I can tell the connections in the connection pool are not being
>>> closed when the webapp gets republished.
>>>
>>> Has anyone else expierence this problem and is there a work-around?
>>>
>>> Thanks in advance.
>>>
>>> Whatty
>
>
Re: Connection Pooling and reusing connections on republish of Tomcat webapp within IDE [message #202561 is a reply to message #202553] Wed, 17 October 2007 18:44 Go to previous message
Steve Whatmore is currently offline Steve WhatmoreFriend
Messages: 95
Registered: July 2009
Member
Context.xml is located in the META-INF directory and we are using the latest
version of WTP (2.0.1).

The version of Tomcat we are using is 5.5 and nothing special with our
configuration of Tomcat and the IDE.

BTW, I have changed the <res-auth> to Container

<res-auth>Container</res-auth>

and it seems to be behaving (although that could be a side-effect of
something else)

Thanks for the assistance.

Whatty

"Larry Isaacs" <Larry.Isaacs@sas.com> wrote in message
news:ff5dak$63v$1@build.eclipse.org...
> Just to make sure, where is this context.xml located? Also, which version
> of WTP and have you changed anything about how the default server comes
> configured.
>
> Again, I haven't done a lot with connection pools, but I assume the
> closing of connections you are looking for is dependent on the pool being
> garbage collected. Even if the pool is being loaded in the webapp's
> classloader and not in one of the server's classloaders, the old webapp
> classloader can fail to garbage collect for a number of reasons. Some of
> these reasons are bugs internal to Tomcat. Unfortunately, I've lost track
> of which Tomcat versions fix which issues.
>
> Larry
>
> Steve Whatmore wrote:
>> You are correct, I am in fact referring to reloading.
>>
>> This is how I have the resource defined
>>
>> <!-- Connection Pooling Resource Definition -->
>> <resource-ref>
>> <description>Data Source Connection Pool</description>
>> <res-ref-name>jdbc/sybase</res-ref-name>
>> <res-type>javax.sql.DataSource</res-type>
>> <res-auth>Application</res-auth>
>> <res-sharing-scope>Shareable</res-sharing-scope>
>> </resource-ref>
>>
>> and in the context.xml I have the following (some details removed)
>>
>> <Context>
>>
>> <!-- Default set of monitored resources -->
>> <WatchedResource>/WEB-INF/web.xml</WatchedResource>
>>
>> <Resource
>> name="jdbc/sybase"
>> auth="Application"
>> factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory "
>> type="javax.sql.DataSource"
>> driverClassName="com.sybase.jdbc3.jdbc.SybDriver"
>> .... <etc>
>> />
>>
>> </Context>
>>
>> Thus, if I can the <res-auth> attribute to the following that should do
>> it correct?
>>
>> <res-auth>Container</res-auth>
>>
>> Whatty
>>
>> "Larry Isaacs" <Larry.Isaacs@sas.com> wrote in message
>> news:ff4vvf$7vo$1@build.eclipse.org...
>>> I assume by "webapp gets restarted" you referring to what is more
>>> commonly referred to as "reloading". Any reloading triggered by WTP
>>> publishing is under the control of Tomcat and if that's not working, you
>>> may have to resort to restarting the server. I haven't done a lot with
>>> connection pooling, but I believe the easiest way to cause this is to
>>> configure the connection pool as a global resource. Then that pool
>>> would be unaffected by any webapp reloading. Is this the case in your
>>> configuration?
>>>
>>> Cheers,
>>> Larry
>>>
>>> Steve Whatmore wrote:
>>>> Good afternoon,
>>>>
>>>> I am experiencing problems with Tomcat and commons-dbcp when my Tomcat
>>>> webapp gets restarted / republished from within the IDE.
>>>>
>>>> As far as I can tell the connections in the connection pool are not
>>>> being closed when the webapp gets republished.
>>>>
>>>> Has anyone else expierence this problem and is there a work-around?
>>>>
>>>> Thanks in advance.
>>>>
>>>> Whatty
>>
Previous Topic:url with (tomcat) context path not working
Next Topic:Design view of WSDL doesn't link to soap fault type
Goto Forum:
  


Current Time: Mon Dec 22 15:53:46 GMT 2014

Powered by FUDForum. Page generated in 0.02881 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software