Return-Path:
Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org
Received: (qmail 85326 invoked from network); 19 Apr 2006 13:16:23 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199)
by minotaur.apache.org with SMTP; 19 Apr 2006 13:16:23 -0000
Received: (qmail 41489 invoked by uid 500); 19 Apr 2006 13:16:10 -0000
Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org
Received: (qmail 41411 invoked by uid 500); 19 Apr 2006 13:16:09 -0000
Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm
Precedence: bulk
List-Unsubscribe:
List-Help:
List-Post:
List-Id: "Jakarta Commons Users List"
Reply-To: "Jakarta Commons Users List"
Delivered-To: mailing list commons-user@jakarta.apache.org
Received: (qmail 41400 invoked by uid 99); 19 Apr 2006 13:16:09 -0000
Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49)
by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Apr 2006 06:16:09 -0700
X-ASF-Spam-Status: No, hits=0.3 required=10.0
tests=RCVD_IN_NJABL_PROXY
X-Spam-Check-By: apache.org
Received-SPF: pass (asf.osuosl.org: local policy)
Received: from [67.15.60.3] (HELO mail.aftek.com) (67.15.60.3)
by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Apr 2006 06:16:07 -0700
Received: (qmail 1696 invoked by uid 510); 19 Apr 2006 08:30:14 -0500
Received: from preetamp@aftek.com by plain.ev1servers.net by uid 508 with
qmail-scanner-1.22-st-qms
(clamdscan: 0.75.1. perlscan: 1.25-st-qms.
Clear:RC:0(59.95.4.194):SA:0(-102.5/1.7):.
Processed in 2.922407 secs); 19 Apr 2006 13:30:14 -0000
X-Antivirus-MYDOMAIN-Mail-From: preetamp@aftek.com via plain.ev1servers.net
X-Antivirus-MYDOMAIN: 1.22-st-qms (Clear:RC:0(59.95.4.194):SA:0(-102.5/1.7):.
Processed in 2.922407 secs Process 1661)
Received: from unknown (HELO preetamp) (preetamp@aftek.com@59.95.4.194)
by mail.aftek.com with RC4-MD5 encrypted SMTP; 19 Apr 2006 08:30:11 -0500
From: "Preetam Palwe"
To: "Jakarta Commons Users List"
Subject: RE: [Commons DBCP] Cannot get a connection, pool exhausted
Date: Wed, 19 Apr 2006 18:45:41 +0530
Message-ID:
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869
Importance: Normal
In-reply-to: <6bde122b0604181404rce2e917ndc743d22a540a94f@mail.gmail.com>
X-Virus-Checked: Checked by ClamAV on apache.org
X-Old-Spam-Status: No, hits=-102.5 required=1.7
X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N
thanks !
but
even if i dont close hibernate session, hibernate will close those for me
right ?
the finalize() of org.hibernate.jdbc.JDBCContext will do this job for me
right ?
i checked the hibernate log and i have seen ....
2006 04 19 11:20:53 ADC [Finalizer] [DEBUG] JDBCContext.finalize() - running
Session.finalize()
2006 04 19 11:20:53 ADC [Finalizer] [WARN ] JDBCContext.finalize() -
unclosed connection, forgot to call close() on your session?
it means when the session object will get garbage colleced at that time it
will close the corresponding connection ....
any other thoughts ?
-----Original Message-----
From: sandymac@gmail.com [mailto:sandymac@gmail.com]On Behalf Of Sandy
McArthur
Sent: Wednesday, April 19, 2006 2:35 AM
To: Jakarta Commons Users List
Subject: Re: [Commons DBCP] Cannot get a connection, pool exhausted
There are two probable reasons for this.
1. You are experiencing high enough load that you've run out of
concurrent connections. If this is the case just bump the pool size,
but this isn't as likely as #2 if it happens after a while.
2. You are forgetting to return/close/cleanup any sessions you create.
It's been a while since I've used hibernate but there is a start/end
transaction aspect. If you start a transaction, and never end it
(maybe because of an exception), the transaction will never be freed.
Since Hibernate uses a Dbcp connection which uses Pool to
borrow/return objects if Pool never gets borrowed objects back then
eventually the max number of concurrent active connections will be
reached and pool won't allow any more objects to be borrowed and
you'll get the NoSuchElementException you see that caused all those
exceptions.
You really need to return sessions/connections/objects in a finally
block. With web programing you could get an exception at almost any
time when the user clicks the stop button. Be very defensive.
On 4/18/06, Preetam Palwe wrote:
> Hi All,
> I am using DBCP with Hibernate, when I deploy my server
application it
> works fine for some hours and after that for any successive request it
> throws
>
>
> org.hibernate.exception.GenericJDBCException: Cannot open connection
> at
>
org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLSta
> teConverter.java:82)
> at
>
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:70)
> at
>
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java
> :43)
> at
>
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java
> :29)
> at
>
org.hibernate.jdbc.AbstractBatcher.openConnection(AbstractBatcher.java:427)
> at org.hibernate.jdbc.JDBCContext.connect(JDBCContext.java:168)
> at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:103)
> at
> org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:49)
> at
>
org.hibernate.transaction.JDBCTransactionFactory.beginTransaction(JDBCTransa
> ctionFactory.java:24)
> at
> org.hibernate.jdbc.JDBCContext.beginTransaction(JDBCContext.java:231)
> at
> org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1073)
> ...........
> at java.util.TimerThread.mainLoop(Timer.java:432)
> at java.util.TimerThread.run(Timer.java:382)
> Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot get a
> connection, pool exhausted
> at
>
org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.ja
> va:103)
> at
>
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:5
> 40)
> at
>
com.xxx.DBCPConnectionProvider.getConnection(DBCPConnectionProvider.java:243
> )
> at
>
org.hibernate.jdbc.AbstractBatcher.openConnection(AbstractBatcher.java:424)
> ... 11 more
> Caused by: java.util.NoSuchElementException: Timeout waiting for idle
object
> at
>
org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPoo
> l.java:756)
> at
>
org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.ja
> va:95)
> ... 14 more
>
>
> Can anyone please tell me whets going wrong ?
> here is my configuration
> j2sdk 1.4.2_6
> hibernate 3.0
> commons-pool 1.2
> commons-dbcp 1.2.1
> fedora core 3
> and
> hibernate config file looks like
>
>
name="hibernate.connection.provider_class">com.xxx.DBCPConnectionProvider
roperty>
> 20
> 10
> 10000
> select
1
>
> I have taken com.xxx.DBCPConnectionProvider from
> http://wiki.apache.org/jakarta-commons/DBCP/Hibernate
>
>
> Thanks&Regards
> ~Preetam
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
--
Sandy McArthur
"He who dares not offend cannot be honest."
- Thomas Paine
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org