You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by albert quinn <al...@gmail.com> on 2007/11/29 20:44:15 UTC

[Tomcat 5.5.17] Strange Problem With Batabase Connection Pool

  Hi all ! :

  I'm facing a very strange problem. I'm developing a web service with :

    - Apache Axis 2 RC 1.3 running on Tomcat 5.5.17, running on
Windows XP Professional
    - Java JDK 1.5

  I've set up a database connection pool in Tomcat. My Web Service
gets a connection from the pool, sends a query to the Database and
returns some information.

  When I call the Web Service for the first time, it works nice.

  If I call it again, it works nice.

  If I wait a few minutes (10 minutes or 20 minutes) and call it
again, it works nice.

  If I wait about an hour and call it again, the Web Service call
never returns. I've seen the Tomcat logs but no errors are reported.
So, I've been searching about that problem in Google and Tomcat's
mailing lists but I haven't found any useful information about the
strange problem.

  So, I've been debugging the Web Service code :

....
1 - Context ctxt = new InitialContext();
2 - DataSource ds = (DataSource) ctxt.lookup(java:comp/env/jdbc/database);
3 - Connection con = ds.getConnection();
4 - ....	
....

  The lines 1 and 2 are executed, but the 4th line is never reached.
Any idea of what could be happening here or how could I do to discover
what's happening? does it seems to be a bug on my code or a setup
problem?

  Thanks in advance for any kind of help with this annoying error.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat 5.5.17] Strange Problem With Batabase Connection Pool

Posted by Jackie Justice <ja...@comcast.net>.
I don't know why you are writing to me.  I just wanted to get to petedge.
Jackie J
----- Original Message ----- 
From: "Mark Thomas" <ma...@apache.org>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Thursday, November 29, 2007 3:54 PM
Subject: Re: [Tomcat 5.5.17] Strange Problem With Batabase Connection Pool


> albert quinn wrote:
>>   The lines 1 and 2 are executed, but the 4th line is never reached.
>> Any idea of what could be happening here or how could I do to discover
>> what's happening? does it seems to be a bug on my code or a setup
>> problem?
>
> Could you database connection be timing out due to inactivity? It is worth
> adding a validation query to your DBCP configuration and setting
> testOnBorrow to true.
>
> Mark
>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.503 / Virus Database: 269.16.10/1159 - Release Date: 
> 11/29/2007 11:10 AM
>
> 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat 5.5.17] Strange Problem With Batabase Connection Pool

Posted by Jackie Justice <ja...@comcast.net>.
All of a sudden I have gotten several emails concerning tomcat.  All I 
wanted to do was to get to petedge.

Jackie
----- Original Message ----- 
From: "albert quinn" <al...@gmail.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Thursday, November 29, 2007 4:26 PM
Subject: Re: [Tomcat 5.5.17] Strange Problem With Batabase Connection Pool


>  It could be. I'm really lost, and have no idea about what is happening.
>
>  I forgot to tell that, when I call the web service after about an
> hour of inactivity and it waits forever at the 3th line, if i call the
> web service again, it works nice and it keeps on working nice (except
> if I wait about an hour again). So, it could be what you say.
>
>  Any URL where I can learn about the DBCP configuration and how to
> set testOnBorroy to true?.
>
>  MANY thanks for your help with this strange behaviour!!.
>
>
>
> 2007/11/29, Mark Thomas <ma...@apache.org>:
>> albert quinn wrote:
>> >   The lines 1 and 2 are executed, but the 4th line is never reached.
>> > Any idea of what could be happening here or how could I do to discover
>> > what's happening? does it seems to be a bug on my code or a setup
>> > problem?
>>
>> Could you database connection be timing out due to inactivity? It is 
>> worth
>> adding a validation query to your DBCP configuration and setting
>> testOnBorrow to true.
>>
>> Mark
>>
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.503 / Virus Database: 269.16.10/1159 - Release Date: 
> 11/29/2007 11:10 AM
>
> 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat 5.5.17] Strange Problem With Batabase Connection Pool

Posted by albert quinn <al...@gmail.com>.
  Hi, (n+1)-th times !! :

  I've new information about the Database Connection Pool's mistery.
After the last setup, adding testWhileIdle="true" and
timeBetweenEvictionRunsMillis="2400000" it worked nice after about 3
hours of inactivity, but I don't undestand why It seems to work now
and it didn't work before. Any ideas about what could be happening
here?.

  Thanks in advance.

Albert

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat 5.5.17] Strange Problem With Batabase Connection Pool

Posted by albert quinn <al...@gmail.com>.
  Hi for the n-th time ! :

  I've set up testWhileIdle="true" and
timeBetweenEvictionRunsMillis="2400000". I'll try again in about an
hour with this new setup and I'll come back if the new setup give me
any new information.



2007/11/30, albert quinn <al...@gmail.com>:
>  Hi again :
>
>  I've read the URLs about DBCP configuration. Then, I've set up DBCP
> for my connection pool. I've added a validation query and I've set
> testOnBorrow="true". I've tried again and I've achieved the same
> strange behaviour : after about and hour of inactivity, it waits
> forever in the 3th line. No errors reported in the Tomcat logs.
>
>  Any idea of what's happening or what can I do to know what's
> happening?. Thanks in advance.
>
> Albert
>
>
>
> 2007/11/29, albert quinn <al...@gmail.com>:
> >  Hi once more time :
> >
> >  Thanks again for your help. Sorry, I didn't know the connections
> > aren't really closed. I've to leave now, but I'll read the URLs you
> > gave me tomorrow and then, I'll try to set up DHCP properly.
> >
> >  Thanks a lot. I'll come back if I get any kind of new information
> > about the mistery.
> >
> >
> > Albert
> >
> >
> >
> >
> >
> >
> > 2007/11/29, Mark Thomas <ma...@apache.org>:
> > > albert quinn wrote:
> > > >   Hi again, Mark :
> > > >
> > > >   I've benn thinking about the problem and I don't really think it
> > > > could be a problem with database connection timeout due to inactivity
> > > > because when the web service is called, the web service gets a
> > > > connection from the pool, it uses the connection, and then it closes
> > > > the connection before returning the web service results. So, it
> > > > mustn't be a problem with database connection timeout due to
> > > > inactivity, don't you think?
> > >
> > > No. I disagree with your analysis. The point of DBCP is that the
> > > connections aren't closed. When you call close() in your code that just
> > > returns the connection to the pool. The actual database connection remains
> > > open.
> > >
> > > The URL you want is:
> > > http://commons.apache.org/dbcp/configuration.html
> > >
> > > The starting point for DBCP is
> > > http://commons.apache.org/dbcp/
> > >
> > > Mark
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To start a new topic, e-mail: users@tomcat.apache.org
> > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > For additional commands, e-mail: users-help@tomcat.apache.org
> > >
> > >
> >
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat 5.5.17] Strange Problem With Batabase Connection Pool

Posted by albert quinn <al...@gmail.com>.
  Hi again :

  I've read the URLs about DBCP configuration. Then, I've set up DBCP
for my connection pool. I've added a validation query and I've set
testOnBorrow="true". I've tried again and I've achieved the same
strange behaviour : after about and hour of inactivity, it waits
forever in the 3th line. No errors reported in the Tomcat logs.

  Any idea of what's happening or what can I do to know what's
happening?. Thanks in advance.

Albert



2007/11/29, albert quinn <al...@gmail.com>:
>  Hi once more time :
>
>  Thanks again for your help. Sorry, I didn't know the connections
> aren't really closed. I've to leave now, but I'll read the URLs you
> gave me tomorrow and then, I'll try to set up DHCP properly.
>
>  Thanks a lot. I'll come back if I get any kind of new information
> about the mistery.
>
>
> Albert
>
>
>
>
>
>
> 2007/11/29, Mark Thomas <ma...@apache.org>:
> > albert quinn wrote:
> > >   Hi again, Mark :
> > >
> > >   I've benn thinking about the problem and I don't really think it
> > > could be a problem with database connection timeout due to inactivity
> > > because when the web service is called, the web service gets a
> > > connection from the pool, it uses the connection, and then it closes
> > > the connection before returning the web service results. So, it
> > > mustn't be a problem with database connection timeout due to
> > > inactivity, don't you think?
> >
> > No. I disagree with your analysis. The point of DBCP is that the
> > connections aren't closed. When you call close() in your code that just
> > returns the connection to the pool. The actual database connection remains
> > open.
> >
> > The URL you want is:
> > http://commons.apache.org/dbcp/configuration.html
> >
> > The starting point for DBCP is
> > http://commons.apache.org/dbcp/
> >
> > Mark
> >
> >
> >
> > ---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat 5.5.17] Strange Problem With Batabase Connection Pool

Posted by albert quinn <al...@gmail.com>.
  Hi once more time :

  Thanks again for your help. Sorry, I didn't know the connections
aren't really closed. I've to leave now, but I'll read the URLs you
gave me tomorrow and then, I'll try to set up DHCP properly.

  Thanks a lot. I'll come back if I get any kind of new information
about the mistery.


Albert






2007/11/29, Mark Thomas <ma...@apache.org>:
> albert quinn wrote:
> >   Hi again, Mark :
> >
> >   I've benn thinking about the problem and I don't really think it
> > could be a problem with database connection timeout due to inactivity
> > because when the web service is called, the web service gets a
> > connection from the pool, it uses the connection, and then it closes
> > the connection before returning the web service results. So, it
> > mustn't be a problem with database connection timeout due to
> > inactivity, don't you think?
>
> No. I disagree with your analysis. The point of DBCP is that the
> connections aren't closed. When you call close() in your code that just
> returns the connection to the pool. The actual database connection remains
> open.
>
> The URL you want is:
> http://commons.apache.org/dbcp/configuration.html
>
> The starting point for DBCP is
> http://commons.apache.org/dbcp/
>
> Mark
>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat 5.5.17] Strange Problem With Batabase Connection Pool

Posted by Mark Thomas <ma...@apache.org>.
albert quinn wrote:
>   Hi again, Mark :
> 
>   I've benn thinking about the problem and I don't really think it
> could be a problem with database connection timeout due to inactivity
> because when the web service is called, the web service gets a
> connection from the pool, it uses the connection, and then it closes
> the connection before returning the web service results. So, it
> mustn't be a problem with database connection timeout due to
> inactivity, don't you think?

No. I disagree with your analysis. The point of DBCP is that the
connections aren't closed. When you call close() in your code that just
returns the connection to the pool. The actual database connection remains
open.

The URL you want is:
http://commons.apache.org/dbcp/configuration.html

The starting point for DBCP is
http://commons.apache.org/dbcp/

Mark



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat 5.5.17] Strange Problem With Batabase Connection Pool

Posted by albert quinn <al...@gmail.com>.
  Hi again, Mark :

  I've benn thinking about the problem and I don't really think it
could be a problem with database connection timeout due to inactivity
because when the web service is called, the web service gets a
connection from the pool, it uses the connection, and then it closes
the connection before returning the web service results. So, it
mustn't be a problem with database connection timeout due to
inactivity, don't you think?

  Thanks again for your help.



2007/11/29, albert quinn <al...@gmail.com>:
>  It could be. I'm really lost, and have no idea about what is happening.
>
>  I forgot to tell that, when I call the web service after about an
> hour of inactivity and it waits forever at the 3th line, if i call the
> web service again, it works nice and it keeps on working nice (except
> if I wait about an hour again). So, it could be what you say.
>
>  Any URL where I can learn about the DBCP configuration and how to
> set testOnBorroy to true?.
>
>  MANY thanks for your help with this strange behaviour!!.
>
>
>
> 2007/11/29, Mark Thomas <ma...@apache.org>:
> > albert quinn wrote:
> > >   The lines 1 and 2 are executed, but the 4th line is never reached.
> > > Any idea of what could be happening here or how could I do to discover
> > > what's happening? does it seems to be a bug on my code or a setup
> > > problem?
> >
> > Could you database connection be timing out due to inactivity? It is worth
> > adding a validation query to your DBCP configuration and setting
> > testOnBorrow to true.
> >
> > Mark
> >
> >
> >
> > ---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat 5.5.17] Strange Problem With Batabase Connection Pool

Posted by albert quinn <al...@gmail.com>.
  It could be. I'm really lost, and have no idea about what is happening.

  I forgot to tell that, when I call the web service after about an
hour of inactivity and it waits forever at the 3th line, if i call the
web service again, it works nice and it keeps on working nice (except
if I wait about an hour again). So, it could be what you say.

  Any URL where I can learn about the DBCP configuration and how to
set testOnBorroy to true?.

  MANY thanks for your help with this strange behaviour!!.



2007/11/29, Mark Thomas <ma...@apache.org>:
> albert quinn wrote:
> >   The lines 1 and 2 are executed, but the 4th line is never reached.
> > Any idea of what could be happening here or how could I do to discover
> > what's happening? does it seems to be a bug on my code or a setup
> > problem?
>
> Could you database connection be timing out due to inactivity? It is worth
> adding a validation query to your DBCP configuration and setting
> testOnBorrow to true.
>
> Mark
>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [Tomcat 5.5.17] Strange Problem With Batabase Connection Pool

Posted by Mark Thomas <ma...@apache.org>.
albert quinn wrote:
>   The lines 1 and 2 are executed, but the 4th line is never reached.
> Any idea of what could be happening here or how could I do to discover
> what's happening? does it seems to be a bug on my code or a setup
> problem?

Could you database connection be timing out due to inactivity? It is worth
adding a validation query to your DBCP configuration and setting
testOnBorrow to true.

Mark



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org