commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles So <charles...@mac.com>
Subject Re: DBCP exception; very hard to debug
Date Wed, 30 Apr 2003 21:23:20 GMT
Hello,

I think I have finally figured out what's wrong with the set up.

The exception:

>> DBCP borrowObject failed: java.sql.SQLException: Server connection
>> failure during transaction.
>> Attemtped reconnect 3 times. Giving up.
>> Exception in Item org.apache.commons.dbcp.DbcpException:
>> java.sql.SQLException: Server connection failure during transaction.
>> Attemtped reconnect 3 times. Giving up.

is most likely to occur after I have made changes to the code (either  
JSP file or servlet). Please see message included below.

Currently I restarted TC (still using the same configuration and the  
same source code), DIDN'T RE-COMPILE THE SERVLETS NOR MAKE CHANGES TO  
JSP FILES and repeated the actions >5 times trying to trigger the  
exception. No luck thus far! :-)

Although it is still at early stage... I'm still repeating the steps.

I am putting my fingers crossed.




Thanks to everyone who helped me, especially Craig!  Hope someone might  
benefit from this.





On Tuesday, April 29, 2003, at 12:05  AM, Craig R. McClanahan wrote:

>
>
> On Mon, 28 Apr 2003, Charles So wrote:
>
>> Date: Mon, 28 Apr 2003 13:35:07 +0800
>> From: Charles So <charles_so@mac.com>
>> Reply-To: Jakarta Commons Users List <commons-user@jakarta.apache.org>
>> To: tomcat-user@jakarta.apache.org, commons-user@jakarta.apache.org
>> Subject: DBCP exception; very hard to debug
>>
>> Hello,
>>
>> I am using DBCP 1.0 with Tomcat 4.1.24. The other Apache Commons I am
>> using with DBCP1.0 are:
>>
>> commons-collections2.1.jar
>> commons-logging-api.103.jar
>> commons-pool.101.jar
>>
>>
>>
>> The webapp I am writing is set to have a maximum of 40 sessions. The
>> allowed maximum number of connection to MySQL is 210. The minimum
>> number of idle connection is set to 100 at Tomcat level.
>>
>> Each session uses 5 connections to start doing its work.
>>
>
> This is not a very good design for using connection pools (you should
> design your apps so that they do not keep connections allocated in  
> between
> requests), but that is not the fundamental problem here.
>
>> The first time I stress my webapp all is fine. I can see 40 sessions
>> all used up in Tomcat's Manager.
>>
>> I then wait until all sessions to time out and stress it again. This
>> time it is usually OK too.
>>
>> However, the 3rd time it is very likely to have thrown *tons* of this
>> exception:
>>
>>
>>
>> DBCP borrowObject failed: java.sql.SQLException: Server connection
>> failure during transaction.
>> Attemtped reconnect 3 times. Giving up.
>> Exception in Item org.apache.commons.dbcp.DbcpException:
>> java.sql.SQLException: Server connection failure during transaction.
>> Attemtped reconnect 3 times. Giving up.
>>
>>
>>
>> It seems that some objects are not released by DBCP. All 100
>> connections shown in MySQL are idle.
>
> The most likely cause for this is that the app neglects to return
> connections to DBCP (often because an SQLException causes your code to
> skip the release path).  This is not DBCP's problem.
>
>>
>>
>> I tried using the nightly snapshot of DBCP, with all the above other
>> commons. It is even worse. The webapp cannot even run the first time!
>>
>> It would complain:
>>
>> org.apache.jasper.JasperException:
>> org.apache.commons.pool.impl.GenericObjectPool: method ()V not found
>
> That means you've got an old version of commons-pool.jar or
> commons-dbcp.jar around someplace, or you've got them installed in more
> than one place in the class loader hierarchy.
>
> It could also mean you didn't upgrade to the latest nightly build of
> commons-pool (which the latest nightly build of commons-dbcp needs).
>
>
>>          at
>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper. 
>> ja
>> va:254)
>
> Accessing databases directly from a JSP page too ... sheesh :-).
>
> Craig
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>


Mime
View raw message